13#include "eformat/eformat.h"
14#include "clocks/Clock.h"
15#include "clocks/Time.h"
28template <
class TPo
inter>
36 uint32_t nsd =
f.children(sdp, 64);
38 for (
size_t i=0; i<nsd; ++i) {
42 uint32_t nros = sd.
children(rosp, 256);
44 for (
size_t j=0; j<nros; ++j) {
56int main (
int argc,
char** argv)
61 std::cerr <<
"usage: " << argv[0] <<
" <test-file>"
67 double cpu_time_used = 0;
68 uint32_t events_read = 0;
69 uint32_t components_instantiated = 0;
70 RealTimeClock my_clock;
71 uint32_t event_size = 0;
74 std::fstream in(argv[1], std::ios::in|std::ios::binary);
76 std::cerr <<
"File `" << argv[1] <<
"' does not exist?!" << std::endl;
82 std::cout <<
"Working with paged storage with page size = "
85 std::cout <<
"Working with contiguous storage." << std::endl;
88 while (in && in.good() && ! in.eof()) {
91 in.read((
char*)
data, 8);
92 if (!in.good() || in.eof())
break;
95 std::cout <<
"Word at offset " <<
HEX(offset) <<
" is not "
104 size_t to_read =
data[1]<<2;
105 size_t page_counter = 0;
108 while (to_read > 0) {
110 in.read((
char*)paged_event[page_counter], readnow);
117 for (
size_t i=0; i<page_counter; ++i) {
118 myvec[i].iov_base = paged_event[i];
122 myvec[page_counter-1].iov_len =
data[1]<<2 - (page_counter-1)*
PAGE_SIZE;
127 in.read((
char*)event,
data[1]<<2);
130 offset +=
data[1]<<2;
135 const_iterator> fe(mem.begin());
140 event_size += 4*fe.fragment_size_word();
142 Time start = my_clock.time();
144 Time end = my_clock.time();
145 Time diff = end - start;
149 components_instantiated += comps;
155 cpu_time_used += diff.as_milliseconds();
163 std::cerr << std::endl
164 <<
"Uncaught eformat exception: " << ex.
what() << std::endl;
168 std::cerr << std::endl
169 <<
"Uncaught ERS exception: " << ex.
what() << std::endl;
172 catch (std::exception& ex) {
173 std::cerr << std::endl
174 <<
"Uncaught std exception: " << ex.
what() << std::endl;
178 std::cerr << std::endl <<
"Uncaught unknown exception" << std::endl;
183 std::cout << std::endl;
184 std::cout <<
" Statistics for Event Validation:" << std::endl;
185 std::cout <<
" --------------------------------" << std::endl;
186 std::cout <<
" - Total reading time: " << cpu_time_used <<
" millisecs"
188 std::cout <<
" - Validation time per event ("
189 << events_read <<
"): " << cpu_time_used/events_read
190 <<
" millisecs" << std::endl;
191 std::cout <<
" - Average event size: "
192 << event_size/(1024.0*1024*events_read) <<
" megabytes" << std::endl;
193 std::cout <<
" - Validation time per component ("
194 << components_instantiated <<
"): "
195 << 1e3*cpu_time_used/components_instantiated
196 <<
" microsecs" << std::endl;
const char * what() const
Human description message.
TFile f("ana_bhabha660a_dqa_mcPat_zy_old.root")
uint32_t components(const eformat::FullEventFragment< TPointer > &f)