[PATCH] D46602: [clang-tidy] Store checks profiling info as CSV files

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 8 14:44:40 PDT 2018


lebedev.ri created this revision.
lebedev.ri added reviewers: alexfh, sbenza.
Herald added subscribers: mgrang, xazax.hun.

Continuation of https://reviews.llvm.org/D46504.

Example output:

  $ clang-tidy -enable-check-profile -store-check-profile=. -store-check-profile-elide-prefix=. -checks=-*,readability-function-size source.cpp 2>&1 >/dev/null
  $ cat .csv
  "User Time","System Time","User+System","Wall Time","Name"
  8.8420499999973945e-01,1.2026799999999757e-01,1.0044729999997370e+00,1.0031676292419434e+00,"readability-function-size"
  8.8420499999973945e-01,1.2026799999999757e-01,1.0044729999997370e+00,1.0031676292419434e+00,"Total"

There are two arguments that control profile storage:

- `-store-check-profile=<prefix>` This option controls the prefix where these per-TU profiles are stored as CSV. If the prefix is not an absolute path, it is considered to be relative to the directory from where you have run `clang-tidy`. All `.` and `..` patterns in the path are collapsed, and symlinks are resolved.

  **Example**: Let's suppose you have a source file named `example.cpp`, located in `/source` directory.
  - If you specify `-store-check-profile=/tmp`, then the profile will be saved to `/tmp/source/example.cpp.csv`
  - If you run `clang-tidy` from within `/foo` directory, and specify `-store-check-profile=.`, then the profile will still be saved to `/foo/source/example.cpp.csv`
- `-store-check-profile-elide-prefix=<prefix>` When specified, this prefix will be elided from the source file name, before prepending it with the prefix specified by `-store-check-profile`. If the prefix is not an absolute path, it is considered to be relative to the directory from where you have run `clang-tidy`. All `.` and `..` patterns in the path are collapsed, and symlinks are resolved.

  **Example**: Let's suppose you have a source file named `example.cpp`, located in `/source` directory.
  - If you specify `-store-check-profile=/tmp -store-check-profile-elide-prefix=/source` , then the profile will be saved to `/tmp/example.cpp.csv`
  - If you run `clang-tidy` from within `/source` directory, and specify `-store-check-profile=/foo -store-check-profile-elide-prefix=.`, then the profile will be saved to `/foo/example.cpp.csv`


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D46602

Files:
  clang-tidy/ClangTidy.cpp
  clang-tidy/ClangTidy.h
  clang-tidy/ClangTidyDiagnosticConsumer.cpp
  clang-tidy/ClangTidyDiagnosticConsumer.h
  clang-tidy/ClangTidyProfiling.cpp
  clang-tidy/ClangTidyProfiling.h
  clang-tidy/tool/ClangTidyMain.cpp
  docs/ReleaseNotes.rst
  docs/clang-tidy/index.rst
  test/clang-tidy/clang-tidy-store-check-profile-one-tu.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46602.145790.patch
Type: text/x-patch
Size: 33909 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180508/84a2bc94/attachment-0001.bin>


More information about the cfe-commits mailing list