15#include "clocks/Clock.h"
16#include "clocks/Time.h"
30int main (
int argc,
char** argv)
35 std::cerr <<
"usage: " << argv[0] <<
" <test-file>"
41 double cpu_time_used = 0;
42 uint32_t elements_read = 0;
43 uint32_t robs_read = 0;
44 RealTimeClock my_clock;
47 std::fstream in(argv[1], std::ios::in|std::ios::binary);
49 std::cerr <<
"File `" << argv[1] <<
"' does not exist?!" << std::endl;
55 std::cout <<
"Working with paged storage with page size = "
58 std::cout <<
"Working with contiguous storage." << std::endl;
61 while (in && in.good() && ! in.eof()) {
64 in.read((
char*)
data, 8);
65 if (!in.good() || in.eof())
break;
68 std::cout <<
"Word at offset " <<
HEX(offset) <<
" is not "
77 size_t to_read =
data[1]<<2;
78 size_t page_counter = 0;
83 in.read((
char*)paged_event[page_counter], readnow);
90 for (
size_t i=0; i<page_counter; ++i) {
91 myvec[i].iov_base = paged_event[i];
95 myvec[page_counter-1].iov_len =
data[1]<<2 - (page_counter-1)*
PAGE_SIZE;
100 in.read((
char*)event,
data[1]<<2);
103 offset +=
data[1]<<2;
108 const_iterator> fe(mem.begin());
113 typedef const uint32_t* pointer_t;
116 std::vector<pointer_t> robs;
119 uint32_t nsd = fe.children(sdp, 64);
120 for (
size_t i=0; i<nsd; ++i) {
124 uint32_t nros = sd.
children(rosp, 256);
125 for (
size_t j=0; j<nros; ++j) {
128 pointer_t robp[2048];
129 uint32_t nrob = ros.
children(robp, 2048);
130 robs.insert(robs.end(), robp, &robp[nrob]);
134 uint32_t global_counter = 0;
135 Time start = my_clock.time();
136 for (std::vector<pointer_t>::const_iterator it = robs.begin();
137 it != robs.end(); ++it) {
142 for (
size_t m=0; m<ndata; ++m) {
143 global_counter += my[m];
148 Time end = my_clock.time();
149 Time diff = end - start;
150 cpu_time_used += diff.as_milliseconds();
154 std::cerr << std::endl
155 <<
"Uncaught eformat exception: " << ex.
what() << std::endl;
159 std::cerr << std::endl
160 <<
"Uncaught ERS exception: " << ex.
what() << std::endl;
163 catch (std::exception& ex) {
164 std::cerr << std::endl
165 <<
"Uncaught std exception: " << ex.
what() << std::endl;
169 std::cerr << std::endl <<
"Uncaught unknown exception" << std::endl;
174 std::cout <<
" Statistics for ROB data access:" << std::endl;
175 std::cout <<
" -------------------------------" << std::endl;
176 std::cout <<
" - Total reading time: " << cpu_time_used <<
" millisecs"
178 std::cout <<
" - Reading time per ROB ("
179 << robs_read <<
"): " << 1e3*cpu_time_used/robs_read
180 <<
" microsecs" << std::endl;
181 std::cout <<
" - Reading time per data word in a ROB ("
182 << elements_read <<
"): "
183 << 1e6*cpu_time_used/elements_read <<
" nanosecs" << std::endl;
const char * what() const
Human description message.