// Author: Uli Frankenfeld //*-- Copyright © Uli #include "AliL3StandardIncludes.h" #ifndef no_root #include #include #include #include #include #endif #include "AliL3Logging.h" #include "AliL3Benchmark.h" /** // \class AliL3Benchmark //_____________________________________________________________ // // AliL3Benchmark // // Benchmark class for level3 code // // */ ClassImp(AliL3Benchmark) AliL3Benchmark::AliL3Benchmark() { //Constructor fNbench = 0; fNmax = 20; fNames = 0; fTimer = 0; fSum = 0; fMin = 0; fMax = 0; fCount = 0; //fStopwatch = 0; } AliL3Benchmark::~AliL3Benchmark() { fNbench = 0; if (fNames) {delete [] fNames; fNames = 0;} if (fTimer) {delete [] fTimer; fTimer = 0;} if (fSum) {delete [] fSum; fSum = 0;} if (fMin) {delete [] fMin; fMin = 0;} if (fMax) {delete [] fMax; fMax = 0;} if (fCount) {delete [] fCount; fCount =0;} //if(fStopwatch) {delete fStopwatch; fStopwatch =0;} } Int_t AliL3Benchmark::GetBench(const char *name) { for (Int_t i=0;iReset(); //fStopwatch->Start(); } else if (bench >=0) { // Resume the existent benchmark fTimer[bench].Reset(); fTimer[bench].Start(); //if(fStopwatch) {delete fStopwatch; fStopwatch =0;} //fStopwatch = new TStopwatch(); //fStopwatch->Reset(); //fStopwatch->Start(); } else LOG(AliL3Log::kWarning,"AliL3Benchmark::Start","Start") <<"too many benches"<Stop(); //Float_t val = fStopwatch->CpuTime(); fSum[bench] += val; fCount[bench]++; if(fCount[bench]==1){ fMin[bench] = val; fMax[bench] = val; } else{ if(valfMax[bench])fMax[bench]=val; } } void AliL3Benchmark::Analyze(const char* name){ Float_t *x = new Float_t[fNbench]; Float_t *y = new Float_t[fNbench]; Float_t *eyl = new Float_t[fNbench]; Float_t *eyh = new Float_t[fNbench]; char filename[256]; sprintf(filename,"%s.dat",name); FILE *f= fopen(filename,"w"); for (Int_t i=0;iSetTitle("benchmark"); gr->SetMarkerStyle(8); gr->SetMinimum(0); gr->Draw("ALP"); gr->Write(); file->Close(); delete file; file=0; #endif delete[] x; delete[] y; delete[] eyl; delete[] eyh; } Double_t AliL3Benchmark::GetCpuTime() { {return (Double_t)(clock()) / CLOCKS_PER_SEC;} }