[llvm] [BOLT] Filter itrace from perf script mmap & task events (PR #69585)

Jonathan Davies via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 19 03:27:44 PDT 2023


https://github.com/jonathandavies-arm created https://github.com/llvm/llvm-project/pull/69585

perf2bolt launches a few perf script commands and stores the output in temporary files before processing the output and cleaning them up before it exits.

The command `perf script --show-mmap-events` outputs PERF_RECORD_MMAP2 and instruction tracing data but when processed it only looks for PERF_RECORD_MMAP2 and the instruction tracing data is ignored. This is fine for small amounts of instruction trace data but when I've recorded Arm ETM or Intel PT AUX I get lots of it

By adding `--no-itrace` is will just show the PERF_RECORD_MMAP2 records and will save on time running the `perf script`, disk space storing the output & time parsing the output.

It is the same for `perf script --show-task-events` where BOLT is only interested in the PERF_RECORD_COMM & PERF_RECORD_FORK records.

### Data

| Perf Record | Perf Data Size  | MMap Size | MMap No Itrace Size |
|---|---|---|---|
| perf record -e cs_etm/@tmc_etr0/u | 137K | 4468K | 0.632K |
| perf record -e intel_pt//u | 890K | 33378K | 0.673K |


>From 76adef4eacb61c48f1c98f0ffb274d6218417ad8 Mon Sep 17 00:00:00 2001
From: Jonathan Davies <jonathan.davies at arm.com>
Date: Wed, 18 Oct 2023 14:06:47 +0100
Subject: [PATCH] [BOLT] Filter itrace from perf script mmap & task events

---
 bolt/lib/Profile/DataAggregator.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bolt/lib/Profile/DataAggregator.cpp b/bolt/lib/Profile/DataAggregator.cpp
index f8ade24bdc0246a..b26346a4d88c4b3 100644
--- a/bolt/lib/Profile/DataAggregator.cpp
+++ b/bolt/lib/Profile/DataAggregator.cpp
@@ -183,12 +183,12 @@ void DataAggregator::start() {
 
   launchPerfProcess("process events",
                     MMapEventsPPI,
-                    "script --show-mmap-events",
+                    "script --show-mmap-events --no-itrace",
                     /*Wait = */false);
 
   launchPerfProcess("task events",
                     TaskEventsPPI,
-                    "script --show-task-events",
+                    "script --show-task-events --no-itrace",
                     /*Wait = */false);
 }
 



More information about the llvm-commits mailing list