aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
diff options
context:
space:
mode:
authorEllis Hoag <ellis.sparky.hoag@gmail.com>2023-04-12 10:21:38 -0700
committerEllis Hoag <ellis.sparky.hoag@gmail.com>2023-04-13 10:37:05 -0700
commit4bddef4117403a305727d145a9abf6bda700f8ff (patch)
treefecf699626134bbc6558209bb1a4b1b0134349d4 /llvm/tools/llvm-profdata/llvm-profdata.cpp
parentaca110f9dd17f2ec6492e56472a49bd409c185ae (diff)
downloadllvm-4bddef4117403a305727d145a9abf6bda700f8ff.zip
llvm-4bddef4117403a305727d145a9abf6bda700f8ff.tar.gz
llvm-4bddef4117403a305727d145a9abf6bda700f8ff.tar.bz2
[InstrProf][Temporal] Add weight field to traces
As discussed in [0], add a `weight` field to temporal profiling traces found in profiles. This allows users to use the `--weighted-input=` flag in the `llvm-profdata merge` command to weight traces from different scenarios differently. Note that this is a breaking change, but since [1] landed very recently and there is no way to "use" this trace data, there should be no users of this feature. We believe it is acceptable to land this change without bumping the profile format version. [0] https://reviews.llvm.org/D147812#4259507 [1] https://reviews.llvm.org/D147287 Reviewed By: snehasish Differential Revision: https://reviews.llvm.org/D148150
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 44219e4..3db5479 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -344,7 +344,7 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper,
}
if (Reader->hasTemporalProfile()) {
- auto &Traces = Reader->getTemporalProfTraces();
+ auto &Traces = Reader->getTemporalProfTraces(Input.Weight);
if (!Traces.empty())
WC->Writer.addTemporalProfileTraces(
Traces, Reader->getTemporalProfTraceStreamSize());
@@ -1279,8 +1279,8 @@ static int merge_main(int argc, const char *argv[]) {
"temporal-profile-trace-reservoir-size", cl::init(100),
cl::desc("The maximum number of stored temporal profile traces (default: "
"100)"));
- cl::opt<uint64_t> MaxTemporalProfTraceLength(
- "max-temporal-profile-trace-length", cl::init(10000),
+ cl::opt<uint64_t> TemporalProfMaxTraceLength(
+ "temporal-profile-max-trace-length", cl::init(10000),
cl::desc("The maximum length of a single temporal profile trace "
"(default: 10000)"));
@@ -1326,7 +1326,7 @@ static int merge_main(int argc, const char *argv[]) {
mergeInstrProfile(WeightedInputs, DebugInfoFilename, Remapper.get(),
OutputFilename, OutputFormat,
TemporalProfTraceReservoirSize,
- MaxTemporalProfTraceLength, OutputSparse, NumThreads,
+ TemporalProfMaxTraceLength, OutputSparse, NumThreads,
FailureMode, ProfiledBinary);
else
mergeSampleProfile(WeightedInputs, Remapper.get(), OutputFilename,
@@ -2635,9 +2635,9 @@ static int showInstrProfile(
OS << "Temporal Profile Traces (samples=" << Traces.size()
<< " seen=" << Reader->getTemporalProfTraceStreamSize() << "):\n";
for (unsigned i = 0; i < Traces.size(); i++) {
- OS << " Temporal Profile Trace " << i << " (count=" << Traces[i].size()
- << "):\n";
- for (auto &NameRef : Traces[i])
+ OS << " Temporal Profile Trace " << i << " (weight=" << Traces[i].Weight
+ << " count=" << Traces[i].FunctionNameRefs.size() << "):\n";
+ for (auto &NameRef : Traces[i].FunctionNameRefs)
OS << " " << Reader->getSymtab().getFuncName(NameRef) << "\n";
}
}