diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2018-06-06 15:07:51 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2018-06-06 15:07:51 +0000 |
commit | a87f1d04cee8168c91d497f9589dc038b3863b14 (patch) | |
tree | 686d92842969cd48458986ca5e1d2f583df248f4 /clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp | |
parent | c4b7e0125ffb7ccb66f39c8ebee32145a322c6b0 (diff) | |
download | bcm5719-llvm-a87f1d04cee8168c91d497f9589dc038b3863b14.tar.gz bcm5719-llvm-a87f1d04cee8168c91d497f9589dc038b3863b14.zip |
[clang-tidy] Store checks profiling info as JSON files
Summary:
Continuation of D46504.
Example output:
```
$ clang-tidy -enable-check-profile -store-check-profile=. -checks=-*,readability-function-size source.cpp
$ # Note that there won't be timings table printed to the console.
$ cat *.json
{
"file": "/path/to/source.cpp",
"timestamp": "2018-05-16 16:13:18.717446360",
"profile": {
"time.clang-tidy.readability-function-size.wall": 1.0421266555786133e+00,
"time.clang-tidy.readability-function-size.user": 9.2088400000005421e-01,
"time.clang-tidy.readability-function-size.sys": 1.2418899999999974e-01
}
}
```
There are two arguments that control profile storage:
* `-store-check-profile=<prefix>`
By default reports are printed in tabulated format to stderr. When this option
is passed, these per-TU profiles are instead stored as JSON.
If the prefix is not an absolute path, it is considered to be relative to the
directory from where you have run :program:`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/<timestamp>-example.cpp.json`
* If you run :program:`clang-tidy` from within `/foo` directory, and specify
`-store-check-profile=.`, then the profile will still be saved to
`/foo/<timestamp>-example.cpp.json`
Reviewers: alexfh, sbenza, george.karpenkov, NoQ, aaron.ballman
Reviewed By: alexfh, george.karpenkov, aaron.ballman
Subscribers: Quuxplusone, JonasToth, aaron.ballman, llvm-commits, rja, Eugene.Zelenko, xazax.hun, mgrang, cfe-commits
Tags: #clang-tools-extra
Differential Revision: https://reviews.llvm.org/D46602
llvm-svn: 334101
Diffstat (limited to 'clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp')
-rw-r--r-- | clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp b/clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp index 18137ba4e14..df4cb93f2ce 100644 --- a/clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp +++ b/clang-tools-extra/test/clang-tidy/clang-tidy-enable-check-profile-one-tu.cpp @@ -1,16 +1,22 @@ // RUN: clang-tidy -enable-check-profile -checks='-*,readability-function-size' %s -- 2>&1 | FileCheck --match-full-lines -implicit-check-not='{{warning:|error:}}' %s // CHECK: ===-------------------------------------------------------------------------=== -// CHECK-NEXT: {{.*}} --- Name --- +// CHECK-NEXT: clang-tidy checks profiling +// CHECK-NEXT: ===-------------------------------------------------------------------------=== +// CHECK-NEXT: Total Execution Time: {{.*}} seconds ({{.*}} wall clock) + +// CHECK: {{.*}} --- Name --- // CHECK-NEXT: {{.*}} readability-function-size // CHECK-NEXT: {{.*}} Total -// CHECK-NEXT: ===-------------------------------------------------------------------------=== // CHECK-NOT: ===-------------------------------------------------------------------------=== +// CHECK-NOT: clang-tidy checks profiling +// CHECK-NOT: ===-------------------------------------------------------------------------=== +// CHECK-NOT: Total Execution Time: {{.*}} seconds ({{.*}} wall clock) + // CHECK-NOT: {{.*}} --- Name --- // CHECK-NOT: {{.*}} readability-function-size // CHECK-NOT: {{.*}} Total -// CHECK-NOT: ===-------------------------------------------------------------------------=== class A { A() {} |