dongjunduo created this revision.
Herald added a project: All.
dongjunduo requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Add a new clang option "-ftime-trace-path".

The time profiler traces the stages during the clang compile 
process. Each compiling stage of a single source file 
corresponds to a separately .json file which holds its 
time tracing data. However, the .json files are stored in the 
same path/directory as its corresponding stage's '-o' option.
For example, if we compile the "demo.cc" to "demo.o" with option
"-o /tmp/demo.o", the time trace data file path is "/tmp/demo.json".

A typical c++ project can contain multiple source files in different 
path, but all the json files' paths can be a mess.

The option "-ftime-trace-path" allows you to specify where the json 
files should be stored. This allows the users to place the time trace 
data files of interest in the desired location for further data analysis.

Usage:

  clang/clang++ -ftime-trace -ftime-trace-path=/path-you-want/ ...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D128046

Files:
  clang/tools/driver/cc1_main.cpp


Index: clang/tools/driver/cc1_main.cpp
===================================================================
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -255,8 +255,7 @@
 
   if (llvm::timeTraceProfilerEnabled()) {
     SmallString<128> Path(Clang->getFrontendOpts().TimeTracePath);
-    Path.append(llvm::sys::path::filename(
-        Clang->getFrontendOpts().OutputFile));
+    
Path.append(llvm::sys::path::filename(Clang->getFrontendOpts().OutputFile));
     Path.append(".json");
     if (auto profilerOutput = Clang->createOutputFile(
             Path.str(), /*Binary=*/false, /*RemoveFileOnSignal=*/false,


Index: clang/tools/driver/cc1_main.cpp
===================================================================
--- clang/tools/driver/cc1_main.cpp
+++ clang/tools/driver/cc1_main.cpp
@@ -255,8 +255,7 @@
 
   if (llvm::timeTraceProfilerEnabled()) {
     SmallString<128> Path(Clang->getFrontendOpts().TimeTracePath);
-    Path.append(llvm::sys::path::filename(
-        Clang->getFrontendOpts().OutputFile));
+    Path.append(llvm::sys::path::filename(Clang->getFrontendOpts().OutputFile));
     Path.append(".json");
     if (auto profilerOutput = Clang->createOutputFile(
             Path.str(), /*Binary=*/false, /*RemoveFileOnSignal=*/false,
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to