28 unordered_map<std::string, std::vector<timeb> >
time1;
30 unordered_map<std::string, std::vector<timeb> >
time2;
35 time1[key].push_back ( t );
36 ftime ( &time1[key][time1[key].size() - 1] );
42 time2[key].push_back ( t );
53 void write ( std::ostream &o ) {
54 for ( unordered_map<std::string, std::vector<timeb> >::iterator itx =
55 time2.begin(); itx != time2.end(); itx++ ) {
56 USER_CHECK ( time1[itx->first].size() == itx->second.size(),
57 "Mismatch with SpeedStats (each setTimeStart needs a setTimeEnd" );
58 o << std::setw ( 30 ) << setiosflags ( std::ios::right ) << itx->first <<
":";
60 for (
unsigned k = 0; k < itx->second.size() - 1 ; ++k ) {
61 fst_time += ( itx->second[k].time - time1[itx->first][k].time ) * 1000;
62 fst_time += itx->second[k].millitm - time1[itx->first][k].millitm;
64 int64 last_time = ( itx->second[itx->second.size() - 1].time -
65 time1[itx->first][itx->second.size() - 1].time ) * 1000
66 + itx->second[itx->second.size() - 1].millitm -
67 time1[itx->first][itx->second.size() - 1].millitm;
68 fst_time += last_time;
69 o << std::setw ( 10 ) << last_time;
70 o << std::setw ( 10 ) << fst_time ;
71 o <<
" (" << itx->second.size() <<
" times )" << endl;
101 unordered_map<std::string, std::vector<timeb> >
time1;
103 unordered_map<std::string, std::vector<timeb> >
time2;
118 time1[key].push_back ( t );
119 ftime ( &time1[key][time1[key].size() - 1] );
125 time2[key].push_back ( t );
138 for ( unordered_map<std::string, std::vector<timeb> >::iterator itx =
139 time2.begin(); itx != time2.end(); itx++ ) {
140 USER_CHECK ( time1[itx->first].size() == itx->second.size(),
141 "Mismatch with SpeedStats (each setTimeStart needs a setTimeEnd" );
142 o << std::setw ( 30 ) << setiosflags ( std::ios::right ) << itx->first <<
":";
144 for (
unsigned k = 0; k < itx->second.size() - 1 ; ++k ) {
145 fst_time += ( itx->second[k].time - time1[itx->first][k].time ) * 1000;
146 fst_time += itx->second[k].millitm - time1[itx->first][k].millitm;
148 int64 last_time = ( itx->second[itx->second.size() - 1].time -
149 time1[itx->first][itx->second.size() - 1].time ) * 1000
150 + itx->second[itx->second.size() - 1].millitm -
151 time1[itx->first][itx->second.size() - 1].millitm;
152 fst_time += last_time;
153 o << std::setw ( 10 ) << last_time;
154 o << std::setw ( 10 ) << fst_time ;
155 o <<
" ms (" << itx->second.size() <<
" times )" << endl;
Wrapper stream class that writes to pipes, text files or gzipped files.
#define USER_CHECK(exp, comment)
Tests whether exp is true. If not, comment is printed and program ends.