[llvm] [llvm-mca] Add bottle-neck analysis to JSON output. (PR #90056)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 11:57:53 PDT 2024


================
@@ -641,5 +641,51 @@ void BottleneckAnalysis::printView(raw_ostream &OS) const {
   printCriticalSequence(OS);
 }
 
+json::Value BottleneckAnalysis::toJSON() const {
+  if (!SeenStallCycles || !BPI.PressureIncreaseCycles) {
+    json::Object JO({{"PressureIncreaseCycles", 0}});
+    return JO;
+  }
+
----------------
mshockwave wrote:

nit: would it be better to use `llvm::json::OStream` ([link](https://llvm.org/doxygen/classllvm_1_1json_1_1OStream.html#details)) here rather than storing serialized json objects/array?

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


More information about the llvm-commits mailing list