@@ -46,6 +46,11 @@ static cl::opt<bool>
46
46
cl::desc (" aggregate basic samples (without LBR info)" ),
47
47
cl::cat(AggregatorCategory));
48
48
49
+ static cl::opt<std::string>
50
+ ITraceAggregation (" itrace" ,
51
+ cl::desc (" Generate LBR info with perf itrace argument" ),
52
+ cl::cat(AggregatorCategory));
53
+
49
54
static cl::opt<bool >
50
55
FilterMemProfile (" filter-mem-profile" ,
51
56
cl::desc (" if processing a memory profile, filter out stack or heap accesses "
@@ -155,6 +160,8 @@ void DataAggregator::findPerfExecutable() {
155
160
}
156
161
157
162
void DataAggregator::start () {
163
+ std::string ItracePerfScriptArgs;
164
+
158
165
outs () << " PERF2BOLT: Starting data aggregation job for " << Filename << " \n " ;
159
166
160
167
// Don't launch perf for pre-aggregated files
@@ -163,16 +170,23 @@ void DataAggregator::start() {
163
170
164
171
findPerfExecutable ();
165
172
166
- if (opts::BasicAggregation)
173
+ if (opts::BasicAggregation) {
167
174
launchPerfProcess (" events without LBR" ,
168
175
MainEventsPPI,
169
176
" script -F pid,event,ip" ,
170
177
/* 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 {
172
185
launchPerfProcess (" branch events" ,
173
186
MainEventsPPI,
174
187
" script -F pid,ip,brstack" ,
175
188
/* Wait = */ false );
189
+ }
176
190
177
191
// Note: we launch script for mem events regardless of the option, as the
178
192
// command fails fairly fast if mem events were not collected.
0 commit comments