| 94 | } |
| 95 | |
| 96 | void |
| 97 | StatisticalTimer::Reset( ) |
| 98 | { |
| 99 | if( nEvents == 0 || nSamples == 0 ) |
| 100 | throw std::runtime_error( "StatisticalTimer::Reserve( ) was not called before Reset( )" ); |
| 101 | |
| 102 | clkStart.clear( ); |
| 103 | clkTicks.clear( ); |
| 104 | |
| 105 | clkStart.resize( nEvents ); |
| 106 | clkTicks.resize( nEvents ); |
| 107 | |
| 108 | for( unsigned int i = 0; i < nEvents; ++i ) |
| 109 | { |
| 110 | clkTicks.at( i ).reserve( nSamples ); |
| 111 | } |
| 112 | |
| 113 | return; |
| 114 | } |
| 115 | |
| 116 | // The caller can pre-allocate memory, to improve performance. |
| 117 | // nEvents is an approximate value for how many seperate events the caller will think |