57int main(
int argc,
char** argv ) {
62 std::cerr <<
"usage: " << argv[0] <<
" <test-file>" << std::endl;
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 );
77 std::cerr <<
"File `" << argv[1] <<
"' does not exist?!" << std::endl;
83 std::cout <<
"Working with paged storage with page size = " <<
PAGE_SIZE <<
" bytes."
86 std::cout <<
"Working with contiguous storage." << std::endl;
89 while ( in && in.good() && !in.eof() )
93 in.read( (
char*)
data, 8 );
94 if ( !in.good() || in.eof() )
break;
98 std::cout <<
"Word at offset " <<
HEX( offset ) <<
" is not "
107 size_t to_read =
data[1] << 2;
108 size_t page_counter = 0;
111 while ( to_read > 0 )
114 in.read( (
char*)paged_event[page_counter], readnow );
121 for (
size_t i = 0; i < page_counter; ++i )
123 myvec[i].iov_base = paged_event[i];
127 myvec[page_counter - 1].iov_len =
data[1] << 2 - ( page_counter - 1 ) *
PAGE_SIZE;
132 in.read( (
char*)event,
data[1] << 2 );
135 offset +=
data[1] << 2;
146 event_size += 4 * fe.fragment_size_word();
148 Time start = my_clock.time();
150 Time end = my_clock.time();
151 Time diff = end - start;
155 components_instantiated += comps;
161 cpu_time_used += diff.as_milliseconds();
170 std::cerr << std::endl <<
"Uncaught eformat exception: " << ex.
what() << std::endl;
175 std::cerr << std::endl <<
"Uncaught ERS exception: " << ex.
what() << std::endl;
178 catch ( std::exception& ex )
180 std::cerr << std::endl <<
"Uncaught std exception: " << ex.
what() << std::endl;
184 { std::cerr << std::endl <<
"Uncaught unknown exception" << std::endl; }
187 std::cout << std::endl;
188 std::cout <<
" Statistics for Event Validation:" << std::endl;
189 std::cout <<
" --------------------------------" << std::endl;
190 std::cout <<
" - Total reading time: " << cpu_time_used <<
" millisecs" << std::endl;
191 std::cout <<
" - Validation time per event (" << events_read
192 <<
"): " << cpu_time_used / events_read <<
" millisecs" << std::endl;
193 std::cout <<
" - Average event size: " << event_size / ( 1024.0 * 1024 * events_read )
194 <<
" megabytes" << std::endl;
195 std::cout <<
" - Validation time per component (" << components_instantiated
196 <<
"): " << 1e3 * cpu_time_used / components_instantiated <<
" microsecs"