1 | |
2 | #include <unistd.h> |
3 | #include <stdlib.h> |
4 | #include <stdint.h> |
5 | #include <time.h> |
6 | |
7 | #include <iostream> |
8 | #include <string> |
9 | #include <vector> |
10 | #include <stack> |
11 | #include <thread> |
12 | using namespace std; |
13 | |
14 | |
15 | #include <DAQ/HDEVIO.h> |
16 | |
17 | class WorkerThread; |
18 | |
19 | |
20 | vector<string> filenames; |
21 | |
22 | |
23 | |
24 | |
25 | |
26 | |
27 | void Usage(string mess="") |
28 | { |
29 | |
30 | |
31 | if(mess != "") cout << endl << mess << endl << endl; |
32 | |
33 | exit(0); |
34 | } |
35 | |
36 | |
37 | |
38 | |
39 | void ParseCommandLineArguments(int narg, char *argv[]) |
40 | { |
41 | |
42 | if(narg<2) Usage("You must supply a filename!"); |
43 | |
44 | for(int i=1; i<narg; i++){ |
45 | |
46 | filenames.push_back(argv[i]); |
47 | } |
48 | } |
49 | |
50 | |
51 | |
52 | |
53 | int main(int narg, char *argv[]) |
54 | { |
55 | |
56 | ParseCommandLineArguments(narg, argv); |
57 | |
58 | |
59 | for(uint32_t i=0; i<filenames.size(); i++){ |
| 1 | Loop condition is true. Entering loop body | |
|
| 3 | | Loop condition is true. Entering loop body | |
|
| 5 | | Loop condition is true. Entering loop body | |
|
60 | string &filename = filenames[i]; |
61 | cout << "Processing file " << (i+1) << "/" << filenames.size() << " : " << filename << endl; |
62 | |
63 | HDEVIO *hdevio = new HDEVIO(filename); |
| |
64 | if(!hdevio->is_open){ |
| |
| |
| |
65 | cout << hdevio->err_mess.str() << endl; |
| 8 | | Potential leak of memory pointed to by 'hdevio' |
|
66 | continue; |
67 | } |
68 | |
69 | time_t start_time = time(NULL__null); |
70 | hdevio->PrintFileSummary(); |
71 | time_t end_time = time(NULL__null); |
72 | |
73 | delete hdevio; |
74 | |
75 | cout << (end_time - start_time) << " sec " << endl; |
76 | } |
77 | |
78 | return 0; |
79 | } |
80 | |
81 | |