MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / calcHash

Method calcHash

src/callTraceStorage.cpp:172–201  ·  view source on GitHub ↗

Adaptation of MurmurHash64A by Austin Appleby

Source from the content-addressed store, hash-verified

170
171// Adaptation of MurmurHash64A by Austin Appleby
172u64 CallTraceStorage::calcHash(int num_frames, ASGCT_CallFrame* frames) {
173 const u64 M = 0xc6a4a7935bd1e995ULL;
174 const int R = 47;
175
176 int len = num_frames * sizeof(ASGCT_CallFrame);
177 u64 h = len * M;
178
179 const u64* data = (const u64*)frames;
180 const u64* end = data + len / 8;
181
182 while (data != end) {
183 u64 k = *data++;
184 k *= M;
185 k ^= k >> R;
186 k *= M;
187 h ^= k;
188 h *= M;
189 }
190
191 if (len & 4) {
192 h ^= *(u32*)data;
193 h *= M;
194 }
195
196 h ^= h >> R;
197 h *= M;
198 h ^= h >> R;
199
200 return h;
201}
202
203CallTrace* CallTraceStorage::storeCallTrace(int num_frames, ASGCT_CallFrame* frames) {
204 const size_t header_size = sizeof(CallTrace) - sizeof(ASGCT_CallFrame);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected