00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067 #include <TROOT.h>
00068 #include "TApplication.h"
00069 #include <TSystem.h>
00070 #include <TStopwatch.h>
00071
00072
00073 void runTest(const char *atest, int estimate)
00074 {
00075 if (estimate > 0)
00076 printf("Running : %s, (takes %d RT seconds on the ref machine)\n",atest,estimate);
00077 TString cmdname(gROOT->GetApplication()->Argv(0));
00078 TString prefix(".");
00079 Ssiz_t offset;
00080 #ifdef WIN32
00081 if ((offset = cmdname.Last('\\')) != kNPOS) {
00082 cmdname.Resize(offset);
00083 prefix = cmdname;
00084 }
00085 gSystem->Exec(Form("%s\\%s >>stressHepix.log",prefix.Data(),atest));
00086 #else
00087 if ((offset = cmdname.Last('/')) != kNPOS) {
00088 cmdname.Resize(offset);
00089 prefix = cmdname;
00090 }
00091 gSystem->Exec(Form("%s/%s >>stressHepix.log",prefix.Data(),atest));
00092 #endif
00093 }
00094
00095 int main(int argc, char **argv)
00096 {
00097 TApplication theApp("App", &argc, argv);
00098 printf("\n\nStarting stressHepix benchmark (details will be in stressHepix.log)\n");
00099 printf("Takes 742 CP seconds on a 500 rootmarks machine (IBM Thinkpad centrino 1.4GHz VC++7.1)\n");
00100 printf("Takes 348 CP seconds on a 800 rootmarks reference machine (P IV 2.8 GHz, SLC4 gcc3.4)\n");
00101 printf("Takes 162 CP seconds on a 1710 rootmarks machine (MacPro 2.0GHz gcc4.0.1)\n");
00102 if (gSystem->AccessPathName("atlas.root")) {
00103 printf("\nPreparing geometry files from http://root.cern.ch\n\n");
00104 runTest("stressGeometry", 0);
00105 }
00106 TStopwatch timer;
00107 timer.Start();
00108 gSystem->Exec("echo stressHepix > stressHepix.log");
00109 runTest("stressFit Minuit 2000",12);
00110 runTest("stressLinear",26);
00111 runTest("stressGeometry",118);
00112 runTest("stressSpectrum 1000",190);
00113 runTest("stress -b 3000",124);
00114 timer.Stop();
00115 Double_t rt = timer.RealTime();
00116
00117 FILE *fp = fopen("stressHepix.log","r");
00118 char line[180];
00119 float cput;
00120 Double_t ct = 0;
00121 {
00122 while (fgets(line,180,fp)) {
00123 char *cpu = strstr(line,"Cpu Time =");
00124 if (cpu) {sscanf(cpu+10,"%g",&cput); ct += cput;}
00125 }
00126 }
00127 fclose(fp);
00128 Double_t reftime = 348.3;
00129 const Double_t rootmarks = 800*reftime/ct;
00130
00131
00132 Bool_t UNIX = strcmp(gSystem->GetName(), "Unix") == 0;
00133 printf("\n\n");
00134 printf("****************************************************************************\n");
00135 printf("* *\n");
00136 printf("* S T R E S S H E P I X S U M M A R Y *\n");
00137 printf("* *\n");
00138 printf("* ROOTMARKS =%6.1f * Root%-8s %d/%d\n",rootmarks,gROOT->GetVersion(),
00139 gROOT->GetVersionDate(),gROOT->GetVersionTime());
00140 printf("* *\n");
00141 printf("* Real Time = %6.1f seconds, CpuTime = %6.1f seconds\n",rt,ct);
00142 if (UNIX) {
00143 TString sp = gSystem->GetFromPipe("uname -a");
00144 sp.Resize(60);
00145 printf("* SYS: %s\n",sp.Data());
00146 if (strstr(gSystem->GetBuildNode(),"Linux")) {
00147 sp = gSystem->GetFromPipe("lsb_release -d -s");
00148 printf("* SYS: %s\n",sp.Data());
00149 }
00150 if (strstr(gSystem->GetBuildNode(),"Darwin")) {
00151 sp = gSystem->GetFromPipe("sw_vers -productVersion");
00152 sp += " Mac OS X ";
00153 printf("* SYS: %s\n",sp.Data());
00154 }
00155 } else {
00156 const char *os = gSystem->Getenv("OS");
00157 if (!os) printf("* SYS: Windows 95\n");
00158 else printf("* SYS: %s %s \n",os,gSystem->Getenv("PROCESSOR_IDENTIFIER"));
00159 }
00160 printf("****************************************************************************\n");
00161 }
00162