| 291 | } |
| 292 | |
| 293 | void CallTraceStorage::add(u32 call_trace_id, u64 samples, u64 counter) { |
| 294 | if (call_trace_id > capacity()) { // this also covers call_trace_id == OVERFLOW_TRACE_ID |
| 295 | return; |
| 296 | } |
| 297 | |
| 298 | call_trace_id += (INITIAL_CAPACITY - 1); |
| 299 | for (LongHashTable* table = _current_table; table != NULL; table = table->prev()) { |
| 300 | if (call_trace_id >= table->capacity()) { |
| 301 | CallTraceSample& s = table->values()[call_trace_id - table->capacity()]; |
| 302 | atomicInc(s.samples, samples); |
| 303 | atomicInc(s.counter, counter); |
| 304 | break; |
| 305 | } |
| 306 | } |
| 307 | } |
| 308 | |
| 309 | void CallTraceStorage::resetCounters() { |
| 310 | for (LongHashTable* table = _current_table; table != NULL; table = table->prev()) { |