File tree 2 files changed +10
-8
lines changed
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,6 @@ std::shared_ptr<StringBasedCtxKey> FrameStack::getContextKey() {
129
129
KeyStr->Context = Binary->getExpandedContext (Stack, KeyStr->WasLeafInlined );
130
130
if (KeyStr->Context .empty ())
131
131
return nullptr ;
132
- KeyStr->genHashCode ();
133
132
return KeyStr;
134
133
}
135
134
@@ -143,8 +142,6 @@ std::shared_ptr<ProbeBasedCtxKey> ProbeStack::getContextKey() {
143
142
ProbeBasedKey->Probes );
144
143
CSProfileGenerator::trimContext<const MCDecodedPseudoProbe *>(
145
144
ProbeBasedKey->Probes );
146
-
147
- ProbeBasedKey->genHashCode ();
148
145
return ProbeBasedKey;
149
146
}
150
147
@@ -802,7 +799,6 @@ void UnsymbolizedProfileReader::readUnsymbolizedProfile(StringRef FileName) {
802
799
SampleContext::createCtxVectorFromStr (*I.first , Key->Context );
803
800
TraceIt.advance ();
804
801
}
805
- Key->genHashCode ();
806
802
auto Ret =
807
803
SampleCounters.emplace (Hashable<ContextKey>(Key), SampleCounter ());
808
804
readSampleCounters (TraceIt, Ret.first ->second );
@@ -851,7 +847,6 @@ void PerfScriptReader::generateUnsymbolizedProfile() {
851
847
" Sample counter map should be empty before raw profile generation" );
852
848
std::shared_ptr<StringBasedCtxKey> Key =
853
849
std::make_shared<StringBasedCtxKey>();
854
- Key->genHashCode ();
855
850
SampleCounters.emplace (Hashable<ContextKey>(Key), SampleCounter ());
856
851
for (const auto &Item : AggregatedSamples) {
857
852
const PerfSample *Sample = Item.first .getPtr ();
Original file line number Diff line number Diff line change @@ -314,7 +314,12 @@ struct UnwindState {
314
314
struct ContextKey {
315
315
uint64_t HashCode = 0 ;
316
316
virtual ~ContextKey () = default ;
317
- uint64_t getHashCode () const { return HashCode; }
317
+ uint64_t getHashCode () {
318
+ if (HashCode == 0 )
319
+ genHashCode ();
320
+ return HashCode;
321
+ }
322
+ virtual void genHashCode () = 0;
318
323
virtual bool isEqual (const ContextKey *K) const {
319
324
return HashCode == K->HashCode ;
320
325
};
@@ -341,7 +346,9 @@ struct StringBasedCtxKey : public ContextKey {
341
346
return Context == Other->Context ;
342
347
}
343
348
344
- void genHashCode () { HashCode = hash_value (SampleContextFrames (Context)); }
349
+ void genHashCode () override {
350
+ HashCode = hash_value (SampleContextFrames (Context));
351
+ }
345
352
};
346
353
347
354
// Probe based context key as the intermediate key of context
@@ -364,7 +371,7 @@ struct ProbeBasedCtxKey : public ContextKey {
364
371
O->Probes .end ());
365
372
}
366
373
367
- void genHashCode () {
374
+ void genHashCode () override {
368
375
for (const auto *P : Probes) {
369
376
HashCode = hash_combine (HashCode, P);
370
377
}
You can’t perform that action at this time.
0 commit comments