[PATCH] D131469: [Clang] change default storing path of `-ftime-trace`

dongjunduo via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 9 00:49:05 PDT 2022


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

Change the default storing path of `-ftime-trace`.

We can use `-ftime-trace` or `-ftime-trace=<path>` to switch on the TimeProfiler.
But if we just use `-ftime-trace`, the default storing path is the directory which storing *.o.

The usual use case is that:

  
  $ clang -ftime-trace -o xxx.out xxx.cpp

But the json file will be stored in `/tmp` which stores the temp *.o, thus we CANNOT easily find the time tracing data.

This implementation change the default storing behavior of `-ftime-trace`:

1. If we specified "-ftime-trace=<path>", the time tracing json file would be stored in that `path`;
2. If we just use "-ftime-trace" but compiling with linking action, the json would be stored in the same directory of linking result.
3. If we just use "-ftime-trace" and just compiling source to *.o, the json would be stored in the same directory of *.o.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D131469

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/check-time-trace.cpp
  clang/tools/driver/cc1_main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131469.451060.patch
Type: text/x-patch
Size: 5643 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220809/d784c18c/attachment-0001.bin>


More information about the cfe-commits mailing list