Skip to content

Commit f87cb30

Browse files
[BOLT] Add itrace aggregation for AUX data
1 parent ccc5713 commit f87cb30

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

bolt/lib/Profile/DataAggregator.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ static cl::opt<bool>
4646
cl::desc("aggregate basic samples (without LBR info)"),
4747
cl::cat(AggregatorCategory));
4848

49+
static cl::opt<std::string>
50+
ITraceAggregation("itrace",
51+
cl::desc("Generate LBR info with perf itrace argument"),
52+
cl::cat(AggregatorCategory));
53+
4954
static cl::opt<bool>
5055
FilterMemProfile("filter-mem-profile",
5156
cl::desc("if processing a memory profile, filter out stack or heap accesses "
@@ -155,6 +160,8 @@ void DataAggregator::findPerfExecutable() {
155160
}
156161

157162
void DataAggregator::start() {
163+
std::string ItracePerfScriptArgs;
164+
158165
outs() << "PERF2BOLT: Starting data aggregation job for " << Filename << "\n";
159166

160167
// Don't launch perf for pre-aggregated files
@@ -163,16 +170,23 @@ void DataAggregator::start() {
163170

164171
findPerfExecutable();
165172

166-
if (opts::BasicAggregation)
173+
if (opts::BasicAggregation) {
167174
launchPerfProcess("events without LBR",
168175
MainEventsPPI,
169176
"script -F pid,event,ip",
170177
/*Wait = */false);
171-
else
178+
} else if (!opts::ITraceAggregation.empty()) {
179+
ItracePerfScriptArgs = llvm::formatv(
180+
"script -F pid,ip,brstack --itrace={0}", opts::ITraceAggregation);
181+
launchPerfProcess("branch events with itrace", MainEventsPPI,
182+
ItracePerfScriptArgs.c_str(),
183+
/*Wait = */ false);
184+
} else {
172185
launchPerfProcess("branch events",
173186
MainEventsPPI,
174187
"script -F pid,ip,brstack",
175188
/*Wait = */false);
189+
}
176190

177191
// Note: we launch script for mem events regardless of the option, as the
178192
// command fails fairly fast if mem events were not collected.

0 commit comments

Comments
 (0)