[llvm] [BOLT] Add itrace aggregation for AUX data (PR #70426)
Jonathan Davies via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 6 02:46:12 PST 2023
https://github.com/jonathandavies-arm updated https://github.com/llvm/llvm-project/pull/70426
>From f87cb30f5f0177d283a5baeb2d88b4a3ddf66a7a Mon Sep 17 00:00:00 2001
From: Jonathan Davies <jonathan.davies at arm.com>
Date: Thu, 26 Oct 2023 15:24:00 +0100
Subject: [PATCH 1/2] [BOLT] Add itrace aggregation for AUX data
---
bolt/lib/Profile/DataAggregator.cpp | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index b72bd0edf1a2df2..837dbb6e89c5e5a 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -46,6 +46,11 @@ static cl::opt<bool>
cl::desc("aggregate basic samples (without LBR info)"),
cl::cat(AggregatorCategory));
+static cl::opt<std::string>
+ ITraceAggregation("itrace",
+ cl::desc("Generate LBR info with perf itrace argument"),
+ cl::cat(AggregatorCategory));
+
static cl::opt<bool>
FilterMemProfile("filter-mem-profile",
cl::desc("if processing a memory profile, filter out stack or heap accesses "
@@ -155,6 +160,8 @@ void DataAggregator::findPerfExecutable() {
}
void DataAggregator::start() {
+ std::string ItracePerfScriptArgs;
+
outs() << "PERF2BOLT: Starting data aggregation job for " << Filename << "\n";
// Don't launch perf for pre-aggregated files
@@ -163,16 +170,23 @@ void DataAggregator::start() {
findPerfExecutable();
- if (opts::BasicAggregation)
+ if (opts::BasicAggregation) {
launchPerfProcess("events without LBR",
MainEventsPPI,
"script -F pid,event,ip",
/*Wait = */false);
- else
+ } else if (!opts::ITraceAggregation.empty()) {
+ ItracePerfScriptArgs = llvm::formatv(
+ "script -F pid,ip,brstack --itrace={0}", opts::ITraceAggregation);
+ launchPerfProcess("branch events with itrace", MainEventsPPI,
+ ItracePerfScriptArgs.c_str(),
+ /*Wait = */ false);
+ } else {
launchPerfProcess("branch events",
MainEventsPPI,
"script -F pid,ip,brstack",
/*Wait = */false);
+ }
// Note: we launch script for mem events regardless of the option, as the
// command fails fairly fast if mem events were not collected.
>From c144a5fc559a0c9ff96b5531b286a3847943dc6a Mon Sep 17 00:00:00 2001
From: Jonathan Davies <jonathan.davies at arm.com>
Date: Mon, 6 Nov 2023 10:45:44 +0000
Subject: [PATCH 2/2] Move ItracePerfScriptArgs declaration into if statement
scope
---
bolt/lib/Profile/DataAggregator.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index 837dbb6e89c5e5a..0b306b9965cc3df 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -160,8 +160,6 @@ void DataAggregator::findPerfExecutable() {
}
void DataAggregator::start() {
- std::string ItracePerfScriptArgs;
-
outs() << "PERF2BOLT: Starting data aggregation job for " << Filename << "\n";
// Don't launch perf for pre-aggregated files
@@ -176,7 +174,7 @@ void DataAggregator::start() {
"script -F pid,event,ip",
/*Wait = */false);
} else if (!opts::ITraceAggregation.empty()) {
- ItracePerfScriptArgs = llvm::formatv(
+ std::string ItracePerfScriptArgs = llvm::formatv(
"script -F pid,ip,brstack --itrace={0}", opts::ITraceAggregation);
launchPerfProcess("branch events with itrace", MainEventsPPI,
ItracePerfScriptArgs.c_str(),
More information about the llvm-commits
mailing list