[llvm-profdata] Add overlap command to compute similarity b/w two profile files

Add overlap functionality to llvm-profdata tool to compute the similarity
between two profile files.

Differential Revision: https://reviews.llvm.org/D60977

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359612 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rong Xu
2019-04-30 21:19:12 +00:00
parent 7266bfef68
commit 6967efe577
17 changed files with 718 additions and 3 deletions
+14
View File
@@ -900,3 +900,17 @@ Error IndexedInstrProfReader::readNextRecord(NamedInstrProfRecord &Record) {
}
return success();
}
void InstrProfReader::accumuateCounts(CountSumOrPercent &Sum, bool IsCS) {
uint64_t NumFuncs = 0;
for (const auto &Func : *this) {
if (isIRLevelProfile()) {
bool FuncIsCS = NamedInstrProfRecord::hasCSFlagInHash(Func.Hash);
if (FuncIsCS != IsCS)
continue;
}
Func.accumuateCounts(Sum);
++NumFuncs;
}
Sum.NumEntries = NumFuncs;
}