[llvm-branch-commits] [llvm] Add initial support for SPE brstack format (PR #129231)

Paschalis Mpeis via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Mar 10 10:15:20 PDT 2025


================
@@ -88,6 +89,45 @@ struct PerfSpeEventsTestHelper : public testing::Test {
 
     return SampleSize == DA.BasicSamples.size();
   }
+
+  /// Compare LBREntries
+  bool checkLBREntry(const LBREntry &Lhs, const LBREntry &Rhs) {
+    return Lhs.From == Rhs.From && Lhs.To == Rhs.To &&
+           Lhs.Mispred == Rhs.Mispred;
+  }
+
+  /// Parse and check SPE brstack as LBR
+  void parseAndCheckBrstackEvents(
+      uint64_t PID,
+      const std::vector<SmallVector<LBREntry, 2>> &ExpectedSamples) {
+    int NumSamples = 0;
+
+    DataAggregator DA("<pseudo input>");
+    DA.ParsingBuf = opts::ReadPerfEvents;
+    DA.BC = BC.get();
+    DataAggregator::MMapInfo MMap;
+    DA.BinaryMMapInfo.insert(std::make_pair(PID, MMap));
+
+    // Process buffer.
+    while (DA.hasData()) {
----------------
paschalis-mpeis wrote:

Would it be possible to call `parseBranchEvents` here instead of having a loop and replicating logic?

And then check any relevant buffers (ie `DA.BranchLBRs`  in a loop) ?
(probably no need to FallthroughLBRs at this point).

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


More information about the llvm-branch-commits mailing list