Index: /trunk/Eval/Speed/cpupower.c
===================================================================
--- /trunk/Eval/Speed/cpupower.c	(revision 2536)
+++ /trunk/Eval/Speed/cpupower.c	(revision 2537)
@@ -10,5 +10,5 @@
 /*  ---------------------------------------------------  */
 /*  --- Petit programme d'estimation de la puissance CPU */
-/*  Compilation: csh> cc -O3 -o cpupower cpupower.c      */
+/*  Compilation: csh> cc -O3 -o cpupower cpupower.c -lm  */
 /*  R. Ansari   -   LAL   Mai 2004                       */
 /*  ---------------------------------------------------  */
@@ -19,5 +19,5 @@
 static int SZ;                    /* Taille de tableau */
 static double N_OP;               /* Nb operations */
-static  int OPE;                  /* Choix Operation fop_1 ou fop_2 */
+static  int OPE;                  /* Choix Operation fop_1/2/3/4    */
 static int ckprt;                 /* > 0 : Print check apres calcul */
 
@@ -29,5 +29,5 @@
 void fop_1()
 {
-  T_Type s;
+  T_Type s=0;
   int i,j,k;
   printf("--- fop_1: Double Loop: z[k] = Somme_i(x[k]*y[i]) --- \n");
@@ -42,5 +42,5 @@
 void fop_2() 
 {
-  T_Type s;
+  T_Type s=0;
   int i,j,k;
   printf("--- fop_2: Double Loop: z[k] = Somme_i(x[k]*y[i]+x[i]*y[k]) --- \n");
@@ -55,5 +55,5 @@
 void fop_3() 
 {
-  T_Type s;
+  T_Type s=0;
   int i,j,k;
   printf("--- fop_3: Double Loop: z[k] = Somme_i(x[k]*y[i]+x[i]*y[k]-0.85*(y[k]+x[k])) --- \n");
@@ -62,4 +62,30 @@
     z[k] = s;
     N_OP += 7*SZ;
+  }
+  return;
+}
+
+void fop_4() 
+{
+  T_Type s=0;
+  int i,j,k;
+  printf("--- fop_4: Double Loop: z[k] = Somme_i(x[k]*sin(y[i])+y[k]*cos(x[i])) --- \n");
+  for(k=0; k<SZ; k++) {
+    for(i=0; i<SZ; i++)  s += x[k]*sin(y[i])+y[k]*cos(x[i]);
+    z[k] = s;
+    N_OP += 70*SZ;  // le facteur 70 est approximatif
+  }
+  return;
+}
+
+void fop_5() 
+{
+  T_Type s=0;
+  int i,j,k;
+  printf("--- fop_5: Double Loop: z[k] = Somme_i(x[k]*sin(y[i])+log(fabs(x[i])+0.1)+y[k]) --- \n");
+  for(k=0; k<SZ; k++) {
+    for(i=0; i<SZ; i++)  s += x[k]*sin(y[i])+log(fabs(x[i])+0.1)+y[k];
+    z[k] = s;
+    N_OP += 100*SZ;  // le facteur 100 est approximatif
   }
   return;
@@ -84,4 +110,9 @@
     printf("--- Programme cpupower: (Puissance de calcul) ---- \n");
     printf("  Usage cpupower Op=1/2/3 [Size=20000] [CkPrt=0] \n");
+    printf("  Op=1 Double Loop: z[k] = Somme_i(x[k]*y[i]) \n");
+    printf("  Op=2 Double Loop: z[k] = Somme_i(x[k]*y[i]+x[i]*y[k]) \n");
+    printf("  Op=3 Double Loop: z[k] = Somme_i(x[k]*y[i]+x[i]*y[k]-0.85*(y[k]+x[k])) \n");
+    printf("  Op=4 Double Loop: z[k] = Somme_i(x[k]*sin(y[i])+y[k]*cos(x[i])) \n");
+    printf("  Op=5 Double Loop: z[k] = Somme_i(x[k]*sin(y[i])+log(fabs(x[i])+0.1)+y[k]) \n");
     return 1;
   } 
@@ -103,5 +134,7 @@
   }
   PrtTim("--Fin malloc+init x,y,z ");
-  if (OPE == 3)  fop_3();
+  if (OPE == 5)  fop_5();
+  else if (OPE == 4)  fop_4();
+  else if (OPE == 3)  fop_3();
   else if (OPE == 2)  fop_2();
   else fop_1();
Index: /trunk/Eval/Speed/cpupower.java
===================================================================
--- /trunk/Eval/Speed/cpupower.java	(revision 2537)
+++ /trunk/Eval/Speed/cpupower.java	(revision 2537)
@@ -0,0 +1,137 @@
+/*  Class CPUPower .. Test performances CPU en Java     */
+/*  Compilation: javac cpupower.java                    */
+/*  Execution: java CPUPower Ope Size                   */ 
+/*  R. Ansari - LAL/UPS - Mai 2004                      */
+
+import java.lang.*;
+
+class CPUPower {
+ 
+  public static void main(String[] args) throws java.io.IOException {
+    if (args.length < 1) { 
+	System.out.println("Java CPUPower.main() Usage: java CPUPower Ope=1/2/3/4/5 [Size=20000]");
+      return;
+    }
+    Integer aOp = new Integer(args[0]);
+    Integer N;
+    if (args.length > 1) N  = new Integer(args[1]);
+    else N = new Integer("20000");
+    int sz = N.intValue();
+    if (sz < 10) sz = 20000;
+    int ope = aOp.intValue();
+    System.out.println("Java CPUPower: OPE= " + ope + " SZ= " + sz);    
+    CPUPower cpup = new CPUPower(sz);
+    cpup.Compute(ope);    
+  }
+
+  double x[];
+  double y[];
+  double z[];
+  int SZ;
+  int OPE;
+  long N_OP;
+  long tml,tm,dtm;
+ 
+  CPUPower(int sz) {   
+    tml = System.currentTimeMillis();
+    SZ = sz;
+    x = new double[SZ];
+    y = new double[SZ];
+    z = new double[SZ];
+    int k;
+    for(k=0; k<SZ; k++) {
+      double xx = (k%340);
+      x[k] = Math.PI*Math.exp(-xx/160.);
+      y[k] = Math.sin(x[k]);
+      z[k] = 0.;
+    }
+    N_OP = 0;
+    tm = System.currentTimeMillis();
+    dtm = tm-tml;
+    tml = tm;
+    System.out.println("CPUPower.CPUPower  Time= " + dtm + "  ms ..."); 
+
+  }
+
+  public void Compute(int ope) { 
+    OPE = ope;
+    System.out.println("CPUPower.Compute() OPE= " + OPE );
+    tml = System.currentTimeMillis();
+    if (OPE == 5)  fop5();
+    else if (OPE == 4)  fop4();
+    else if (OPE == 3)  fop3();
+    else if (OPE == 2)  fop2();
+    else fop1();
+    tm = System.currentTimeMillis();
+    dtm = tm-tml;
+    tml = tm;
+    double mflops = N_OP;
+    mflops = mflops/dtm*1.e-3;
+    System.out.println("CPUPower.Compute() N_OP= " + N_OP + " Time= " + dtm + "  ms ");
+    System.out.println("CPUPower.Compute()  Time= " + dtm + "  ms  -> MFLOPS= " + mflops); 
+  }
+
+  public void fop1() {
+    System.out.println("CPUPower.fop1(): Double Loop: z[k] = Somme_i(x[k]*y[i]) --");
+    int i,j,k;
+    double s = 0.;
+    for(k=0; k<SZ; k++) {
+      for(i=0; i<SZ; i++)  s += x[k]*y[i];
+      z[k] = s;
+      N_OP += 2*SZ;
+    }    
+    return;
+  }
+ 
+  public void fop2() {
+    System.out.println("CPUPower.fop2() Double Loop: z[k] = Somme_i(x[k]*y[i]+x[i]*y[k] --");
+    double s = 0.;
+    int i,j,k;
+    for(k=0; k<SZ; k++) {
+      for(i=0; i<SZ; i++)  s += x[k]*y[i]+x[i]*y[k];
+      z[k] = s;
+      N_OP += 4*SZ;
+    }
+
+  return;
+  }
+
+  public void fop3() {
+    System.out.println("CPUPower.fop3() Double Loop: z[k] = Somme_i(x[k]*y[i]+x[i]*y[k]-0.85*(y[k]+x[k])) --");
+    double s = 0.;
+    int i,j,k;
+    for(k=0; k<SZ; k++) {
+      for(i=0; i<SZ; i++)  s += x[k]*y[i]+x[i]*y[k]-0.85*(y[k]+x[k]);
+      z[k] = s;
+      N_OP += 7*SZ;
+    }
+  return;
+  }
+  public void fop4() {
+    System.out.println("CPUPower.fop4() Double Loop: z[k] = Somme_i(x[k]*sin(y[i])+y[k]*cos(x[i])) --");
+    double s = 0.;
+    int i,j,k;
+    for(k=0; k<SZ; k++) {
+      for(i=0; i<SZ; i++)  s += x[k]*Math.sin(y[i])+y[k]*Math.cos(x[i]);
+      z[k] = s;
+      N_OP += 70*SZ;  // le facteur 70 est approximatif
+    }
+  }
+  public void fop5() {
+    System.out.println("CPUPower.fop5() Double Loop: z[k] = Somme_i(x[k]*sin(y[i])+log(abs(x[i])+0.1)+y[k]) --");
+    double s = 0.;
+    int i,j,k;
+    for(k=0; k<SZ; k++) {
+      for(i=0; i<SZ; i++)  s += x[k]*Math.sin(y[i])+Math.log(Math.abs(x[i])+0.1)+y[k];
+      z[k] = s;
+      N_OP += 100*SZ;  // le facteur 100 est approximatif
+    }
+  }
+
+}
+
+
+
+
+
+
