[llvm] [Bolt] Add a new hidden option to perf2bolt for testing purpose (PR #163785)

Amir Ayupov via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 4 23:57:06 PST 2025


================
@@ -440,6 +440,32 @@ class DataAggregator : public DataReader {
   /// B 4b196f 4b19e0 2 0
   void parsePreAggregated();
 
+  /// Detect whether the parsed line is an mmap event or not.
+  bool isMMapEvent(StringRef Line);
+
+  /// Coordinate reading and parsing a hybrid perf-script trace created by
+  /// the following Linux perf script command:
+  /// 'perf script --show-mmap-events -F pid,brstack --itrace=bl -i perf.data'
+  ///
+  /// Note:
+  /// The original perf.data should be profiled with '-b' or 'Arm Spe'.
+  ///
+  /// How the output of this command looks like:
+  /// {<name> .* <sec>.<usec>: }PERF_RECORD_MMAP2 <pid>/<tid>: .* <file_name>
+  /// {<name> .* <sec>.<usec>: }PERF_RECORD_MMAP2 <pid>/<tid>: .* <file_name>
+  ///  PID  {FROM/TO/P/-/-/1/COND/-}+
+  ///  PID  {FROM/TO/P/-/-/1/COND/-}+
+  ///
+  /// The hybrid profile means it contains mmap events along with branch events.
+  /// An mmap event might appear among the branch events, therefore
+  /// Bolt will read this hybrid profile, selects the mmap events, the other
+  /// events treat as branch event.
+  /// Then it prepares the ParsingBuf based on the classification and
+  /// call the proper functions like parseMMapEvents() or parseBranchEvents().
+  ///
+  /// This option is only for testing purposes.
----------------
aaupov wrote:

Please add a couple of perf script examples and drop this line. You can find some under llvm/test/tools/llvm-profgen.

https://github.com/llvm/llvm-project/pull/163785


More information about the llvm-commits mailing list