]>
Commit | Line | Data |
---|---|---|
3551db50 | 1 | #if !defined( __CINT__) || defined(__MAKECINT__) |
2 | ||
3 | #include <iostream> | |
4 | ||
31a8b45f | 5 | #include "AliTRDcalibDB.h" |
6 | #include <TStopwatch.h> | |
3551db50 | 7 | |
31a8b45f | 8 | #endif |
3551db50 | 9 | |
31a8b45f | 10 | #define BENCHMARK(code, comment) \ |
11 | timer.Reset(); timer.Start(); \ | |
12 | for (Int_t i=0; i<NUMBER; ++i) { \ | |
13 | code \ | |
14 | } \ | |
15 | timer.Stop(); \ | |
16 | cerr << "Tested " << NUMBER << " times: " << comment << ". Time/call: " << timer.CpuTime() / NUMBER << endl; \ | |
17 | timer.Print(); | |
3551db50 | 18 | |
31a8b45f | 19 | #define NUMBER 100000 |
3551db50 | 20 | |
21 | void AliTRDbenchmarkCalibDB() | |
22 | { | |
31a8b45f | 23 | TStopwatch timer; |
24 | AliTRDcalibDB* calib = AliTRDcalibDB::Instance(); | |
25 | if (!calib) | |
26 | { | |
27 | cerr << "calibDB singleton has already been terminated." << endl; | |
28 | return; | |
29 | } | |
30 | ||
31 | Float_t xyz[3]; | |
32 | ||
33 | calib->SetRun(1); | |
34 | calib->SetRun(0); | |
35 | calib->GetNumberOfTimeBins(); | |
36 | ||
37 | BENCHMARK(calib->GetNumberOfTimeBins();, "GetNumberOfTimeBins"); | |
38 | BENCHMARK(calib->GetChamberPos(1, xyz);, "GetChamberPos"); | |
39 | BENCHMARK(calib->GetVdrift(1, 1, 1);, "GetVdrift"); | |
40 | ||
41 | #undef NUMBER | |
42 | #define NUMBER 10000 | |
43 | BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetNumberOfTimeBins();, "GetNumberOfTimeBins with invalidating"); | |
44 | BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetChamberPos(1, xyz);, "GetChamberPos with invalidating"); | |
45 | #undef NUMBER | |
46 | #define NUMBER 200 | |
47 | BENCHMARK(calib->SetRun(1); calib->SetRun(0); calib->GetVdrift(1, 1, 1);, "GetVdrift with invalidating"); | |
48 | ||
49 | AliTRDcalibDB::Terminate(); | |
3551db50 | 50 | } |