[PATCH] D61914: [Support][Test] Time profiler: add regression test

Anton Afanasyev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 7 05:57:24 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL362792: [Support][Test] Time profiler: add regression test (authored by anton-afanasyev, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D61914?vs=203532&id=203544#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D61914/new/

https://reviews.llvm.org/D61914

Files:
  cfe/trunk/test/Driver/check-time-trace.cpp
  cfe/trunk/tools/driver/cc1_main.cpp


Index: cfe/trunk/test/Driver/check-time-trace.cpp
===================================================================
--- cfe/trunk/test/Driver/check-time-trace.cpp
+++ cfe/trunk/test/Driver/check-time-trace.cpp
@@ -0,0 +1,23 @@
+// RUN: %clangxx -ftime-trace %s 2>&1 | grep "Time trace json-file dumped to" \
+// RUN:   | awk '{print $NF}' | xargs cat \
+// RUN:   | %python -c 'import json, sys; json.dump(json.loads(sys.stdin.read()), sys.stdout, sort_keys=True, indent=2)' \
+// RUN:   | FileCheck %s
+
+// CHECK: "traceEvents": [
+// CHECK: "args":
+// CHECK: "detail":
+// CHECK: "dur":
+// CHECK: "name": "Source"
+// CHECK-NEXT: "ph":
+// CHECK-NEXT: "pid":
+// CHECK-NEXT: "tid":
+// CHECK-NEXT: "ts":
+// CHECK: "name": "clang"
+// CHECK: "name": "process_name"
+
+#include <iostream>
+
+int main() {
+  std::cout << "Foo" << std::endl;
+  return 0;
+}
Index: cfe/trunk/tools/driver/cc1_main.cpp
===================================================================
--- cfe/trunk/tools/driver/cc1_main.cpp
+++ cfe/trunk/tools/driver/cc1_main.cpp
@@ -241,6 +241,11 @@
 
     llvm::timeTraceProfilerWrite(*profilerOutput);
     llvm::timeTraceProfilerCleanup();
+
+    llvm::errs() << "Time trace json-file dumped to " << Path.str() << "\n";
+    llvm::errs()
+        << "Use chrome://tracing or Speedscope App "
+           "(https://www.speedscope.app) for flamegraph visualization\n";
   }
 
   // Our error handler depends on the Diagnostics object, which we're


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D61914.203544.patch
Type: text/x-patch
Size: 1473 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190607/8323a64a/attachment.bin>


More information about the cfe-commits mailing list