The caller can pre-allocate memory, to improve performance. nEvents is an approximate value for how many seperate events the caller will think they will need, and nSamples is a hint on how many samples we think we will take per event
| 160 | // they will need, and nSamples is a hint on how many samples we think we will take |
| 161 | // per event |
| 162 | void |
| 163 | CpuStatTimer::Reserve( size_t nEvents, size_t nSamples ) |
| 164 | { |
| 165 | this->nEvents = std::max< size_t >( 1, nEvents ); |
| 166 | this->nSamples = std::max< size_t >( 1, nSamples ); |
| 167 | |
| 168 | Clear( ); |
| 169 | labelID.reserve( nEvents ); |
| 170 | |
| 171 | clkStart.resize( nEvents ); |
| 172 | clkTicks.resize( nEvents ); |
| 173 | |
| 174 | for( cl_uint i = 0; i < nEvents; ++i ) |
| 175 | { |
| 176 | clkTicks.at( i ).reserve( nSamples ); |
| 177 | } |
| 178 | } |
| 179 | |
| 180 | void |
| 181 | CpuStatTimer::setNormalize( bool norm ) |