]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/testDecoder.cxx
Effective c++, committed on behalf of �ystein Djuvsland
[u/mrichter/AliRoot.git] / HLT / PHOS / testDecoder.cxx
CommitLineData
241d9cf8 1#include "AliHLTDDLDecoder.h"
2#include "AliHLTAltroData.h"
3#include "Rtypes.h"
4#include <iostream>
5#include <fstream>
6#include <iomanip>
7#include <cstdlib>
6e709a0d 8#include <time.h>
9#include "stdio.h"
241d9cf8 10
11using namespace std;
12
6e709a0d 13///#define N_LOOPS 1000
14
241d9cf8 15int main(int argc, const char** argv)
16{
6e709a0d 17 int n_loops = 1000000;
18
19 clock_t start;
20 clock_t end;
21
241d9cf8 22 AliHLTAltroData altrodata;
23 AliHLTAltroBunch altrobunch;
24
25 ifstream fin;
26 int length;
27
28 AliHLTDDLDecoder *decoder = new AliHLTDDLDecoder();
29
30 fin.open(argv[1], ios::binary);
31
32 fin.seekg (0, ios::end);
33 length = fin.tellg();
34 fin.seekg (0, ios::beg);
35
36 char *dataPtr = new char[length];
37
38 fin.read (dataPtr,length);
39 fin.close();
241d9cf8 40
6e709a0d 41 start =clock();
42
43 for(int i=0; i < n_loops; i++)
241d9cf8 44 {
6e709a0d 45 decoder->SetMemory((UChar_t*)dataPtr, length);
46 decoder->Decode();
47 while(decoder->NextChannel(&altrodata) == true)
48 {
49 // altrodata.Reset();
50 // decoder->PrintInfo(altrodata, altrodata.fDataSize, 4);
241d9cf8 51
6e709a0d 52 // cout << endl;
241d9cf8 53
6e709a0d 54
55
56 while( altrodata.NextBunch(altrobunch) == true)
57 {
58 // cout << "altrobunch.fDataSize = " << altrobunch.fBunchSize << endl;
59 // cout << "altrobunch. fEndTimeBin = " << altrobunch. fEndTimeBin << endl;
60 }
61
241d9cf8 62 }
6e709a0d 63
64 // end = clock();
65
241d9cf8 66 }
67
6e709a0d 68 end = clock();
69
70 float mikro = (float)(((float)end -(float)start)/((float)n_loops));
71
72
73
74 printf("\nProcessing time per event is %f us\n", mikro);
75
241d9cf8 76 decoder->GetFailureRate();
77
6e709a0d 78 // cnt ++;
241d9cf8 79 return 0;
80}