| 214 | } |
| 215 | |
| 216 | CallTrace* CallTraceStorage::findCallTrace(LongHashTable* table, u64 hash) { |
| 217 | u64* keys = table->keys(); |
| 218 | u32 capacity = table->capacity(); |
| 219 | u32 slot = hash & (capacity - 1); |
| 220 | u32 step = 0; |
| 221 | |
| 222 | while (keys[slot] != hash) { |
| 223 | if (keys[slot] == 0) { |
| 224 | return NULL; |
| 225 | } |
| 226 | if (++step >= capacity) { |
| 227 | return NULL; |
| 228 | } |
| 229 | slot = (slot + step) & (capacity - 1); |
| 230 | } |
| 231 | |
| 232 | return table->values()[slot].trace; |
| 233 | } |
| 234 | |
| 235 | u32 CallTraceStorage::put(int num_frames, ASGCT_CallFrame* frames, u64 counter) { |
| 236 | u64 hash = calcHash(num_frames, frames); |