Moved from src
authorvestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Apr 2002 10:13:44 +0000 (10:13 +0000)
committervestbo <vestbo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 16 Apr 2002 10:13:44 +0000 (10:13 +0000)
HLT/programs/doit [new file with mode: 0644]
HLT/programs/speedtest.cxx [new file with mode: 0644]
HLT/programs/speedtest.h [new file with mode: 0644]

diff --git a/HLT/programs/doit b/HLT/programs/doit
new file mode 100644 (file)
index 0000000..2f3bde3
--- /dev/null
@@ -0,0 +1,3 @@
+g++ -O -Wall -fPIC -ffast-math speedtest.cxx -o speedtest
+# g++ -O -Wall -fPIC -mcpu=ev6 speedtest.cxx -o speedtest
+# cxx -O -Wall -fPIC  -lm  speedtest.cxx -o speedtest 
diff --git a/HLT/programs/speedtest.cxx b/HLT/programs/speedtest.cxx
new file mode 100644 (file)
index 0000000..a6211b7
--- /dev/null
@@ -0,0 +1,53 @@
+#include "speedtest.h"
+
+int main(int arg,char **arc){
+  int n = 0;
+  if(arg!=2) {cerr<<"usage: speedtest #loops \n";return -1;}  
+  n = atoi(arc[1]);
+//  cerr<<"allocate: "<<n*sizeof(AliL3ConfMapPoint)<<" Bytes"<<endl;
+//  AliL3ConfMapPoint *array = new AliL3ConfMapPoint[n];
+  cerr<<"allocate: "<<n*sizeof(double)<<" Bytes"<<endl;
+  double *array = new double[n];
+//  cerr<<"allocate: "<<n*sizeof(int)<<" Bytes"<<endl;
+//  int *array = new int[n];
+//  cerr<<"allocate: "<<n*sizeof(AliL3SpacePointData)<<" Bytes"<<endl;
+//  AliL3SpacePointData *array = new AliL3SpacePointData[n];
+
+  AliL3SpacePointData hit;
+  hit.fX=103.55;
+  hit.fY=22.33;
+  hit.fZ=95.312;
+  hit.fID=(4<<25)|14042;
+  hit.fPadRow=77;
+  hit.fXYErr=1;
+  hit.fZErr=2.5;
+
+  cerr<<"start loop"<<endl;
+  double initCpuTime,cpuTime;
+  initCpuTime = CpuTime();
+
+/*  
+  for(int i=0;i<n;i++){
+    array[i].SetHitNumber(hit.fID);
+    array[i].SetPadRow(hit.fPadRow);
+    Int_t slice = (hit.fID>>25) & 0x7f;
+    array[i].SetSector(slice);
+    array[i].SetX(hit.fX);
+    array[i].SetY(hit.fY);
+    array[i].SetZ(hit.fZ);
+    array[i].SetXerr(sqrt((double)hit.fXYErr));
+//    array[i].SetYerr(sqrt(hit.fXYErr));
+//    array[i].SetZerr(sqrt(hit.fZErr));
+  }
+*/
+//  for(int i=0;i<n;i++) array[i].ReadHits(&hit);
+  for(int i=0;i<n;i++) array[i]=sqrt(i); 
+//  for(int i=0;i<n;i++) array[i]=i; 
+//  for(int i=0;i<n;i++) array[i].fX=hit.fX; 
+
+  cpuTime = CpuTime() - initCpuTime;
+//  cerr<<"cpuTime: "<<cpuTime<<endl;
+  printf("cpuTime: %d ms\n",int(cpuTime*1000));
+  return 0;
+}
+
diff --git a/HLT/programs/speedtest.h b/HLT/programs/speedtest.h
new file mode 100644 (file)
index 0000000..f099ed8
--- /dev/null
@@ -0,0 +1,25 @@
+#include <iostream.h>
+#define ALIL3LOGGING_H
+class AliL3Log{
+  public:
+  enum TLogLevel { kNone = 0, kDebug= 0x01, kInformational = 0x02, kWarning = 0x04, kError = 0x08 , kFatal = 0x10, kPrimary = 0x80, kAll = 0x9F };
+  enum TLogCmd { kEnd, kPrec, kHex, kDec };
+};
+#define LOG( lvl, origin, keyword ) cerr
+#define ENDLOG endl
+#define no_root
+
+#include <stdio.h>
+#include <math.h>
+#include <stdlib.h>
+#include <time.h>
+#include "AliL3ConfMapPoint.cxx"
+
+double CpuTime()
+{
+  //Return the Cputime in seconds.
+
+  return (double)(clock()) / CLOCKS_PER_SEC;
+}
+
+