KeyStr->Context = Binary->getExpandedContext(Stack, KeyStr->WasLeafInlined);
if (KeyStr->Context.empty())
return nullptr;
- KeyStr->genHashCode();
return KeyStr;
}
ProbeBasedKey->Probes);
CSProfileGenerator::trimContext<const MCDecodedPseudoProbe *>(
ProbeBasedKey->Probes);
-
- ProbeBasedKey->genHashCode();
return ProbeBasedKey;
}
SampleContext::createCtxVectorFromStr(*I.first, Key->Context);
TraceIt.advance();
}
- Key->genHashCode();
auto Ret =
SampleCounters.emplace(Hashable<ContextKey>(Key), SampleCounter());
readSampleCounters(TraceIt, Ret.first->second);
"Sample counter map should be empty before raw profile generation");
std::shared_ptr<StringBasedCtxKey> Key =
std::make_shared<StringBasedCtxKey>();
- Key->genHashCode();
SampleCounters.emplace(Hashable<ContextKey>(Key), SampleCounter());
for (const auto &Item : AggregatedSamples) {
const PerfSample *Sample = Item.first.getPtr();
struct ContextKey {
uint64_t HashCode = 0;
virtual ~ContextKey() = default;
- uint64_t getHashCode() const { return HashCode; }
+ uint64_t getHashCode() {
+ if (HashCode == 0)
+ genHashCode();
+ return HashCode;
+ }
+ virtual void genHashCode() = 0;
virtual bool isEqual(const ContextKey *K) const {
return HashCode == K->HashCode;
};
return Context == Other->Context;
}
- void genHashCode() { HashCode = hash_value(SampleContextFrames(Context)); }
+ void genHashCode() override {
+ HashCode = hash_value(SampleContextFrames(Context));
+ }
};
// Probe based context key as the intermediate key of context
O->Probes.end());
}
- void genHashCode() {
+ void genHashCode() override {
for (const auto *P : Probes) {
HashCode = hash_combine(HashCode, P);
}