[PATCH] D46931: [llvm-exegesis] Add a flag to output analysis csv to a file.

Clement Courbet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 02:03:48 PDT 2018


courbet created this revision.
courbet added a reviewer: gchatelet.
Herald added a subscriber: tschuett.

Repository:
  rL LLVM

https://reviews.llvm.org/D46931

Files:
  tools/llvm-exegesis/llvm-exegesis.cpp


Index: tools/llvm-exegesis/llvm-exegesis.cpp
===================================================================
--- tools/llvm-exegesis/llvm-exegesis.cpp
+++ tools/llvm-exegesis/llvm-exegesis.cpp
@@ -70,6 +70,10 @@
                     llvm::cl::desc("dbscan epsilon for analysis clustering"),
                     llvm::cl::init(0.1));
 
+static llvm::cl::opt<std::string> AnalysisClustersFile("analysis-clusters-file",
+                                                       llvm::cl::desc(""),
+                                                       llvm::cl::init("-"));
+
 namespace exegesis {
 
 void benchmarkMain() {
@@ -135,7 +139,7 @@
   // FIXME: Check that all points have the same triple/cpu.
   // FIXME: Merge points from several runs (latency and uops).
 
-  //llvm::InitializeAllTargets();
+  // llvm::InitializeAllTargets();
   llvm::InitializeNativeTarget();
   llvm::InitializeNativeTargetAsmPrinter();
 
@@ -151,7 +155,13 @@
 
   const Analysis Analyzer(*TheTarget, Clustering);
 
-  if (auto Err = Analyzer.printClusters(llvm::outs()))
+  std::error_code ErrorCode;
+  llvm::raw_fd_ostream ClustersOS(AnalysisClustersFile, ErrorCode,
+                                  llvm::sys::fs::F_RW);
+  if (ErrorCode)
+    llvm::report_fatal_error("cannot open out file: " + AnalysisClustersFile);
+
+  if (auto Err = Analyzer.printClusters(ClustersOS))
     llvm::report_fatal_error(std::move(Err));
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46931.147015.patch
Type: text/x-patch
Size: 1420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180516/9ffcb9c2/attachment.bin>


More information about the llvm-commits mailing list