[llvm] r332445 - [llvm-exegesis] Add a flag to output analysis csv to a file.

Clement Courbet via llvm-commits llvm-commits at lists.llvm.org
Wed May 16 02:50:04 PDT 2018


Author: courbet
Date: Wed May 16 02:50:04 2018
New Revision: 332445

URL: http://llvm.org/viewvc/llvm-project?rev=332445&view=rev
Log:
[llvm-exegesis] Add a flag to output analysis csv to a file.

Reviewers: gchatelet

Subscribers: llvm-commits, tschuett

Differential Revision: https://reviews.llvm.org/D46931

Modified:
    llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp

Modified: llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp?rev=332445&r1=332444&r2=332445&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp (original)
+++ llvm/trunk/tools/llvm-exegesis/llvm-exegesis.cpp Wed May 16 02:50:04 2018
@@ -70,6 +70,10 @@ static llvm::cl::opt<float>
                     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,6 @@ void analysisMain() {
   // FIXME: Check that all points have the same triple/cpu.
   // FIXME: Merge points from several runs (latency and uops).
 
-  //llvm::InitializeAllTargets();
   llvm::InitializeNativeTarget();
   llvm::InitializeNativeTargetAsmPrinter();
 
@@ -151,7 +154,13 @@ void analysisMain() {
 
   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));
 }
 




More information about the llvm-commits mailing list