[all-commits] [llvm/llvm-project] 03f06b: [clang-query] add basic profiling on matching each...

Ding Fei via All-commits all-commits at lists.llvm.org
Tue Nov 5 05:31:20 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 03f06b97106b84569db8e0277e70e44bb3b1e9b7
      https://github.com/llvm/llvm-project/commit/03f06b97106b84569db8e0277e70e44bb3b1e9b7
  Author: Ding Fei <fding at feysh.com>
  Date:   2024-11-05 (Tue, 05 Nov 2024)

  Changed paths:
    M clang-tools-extra/clang-query/Query.cpp
    M clang-tools-extra/clang-query/QueryParser.cpp
    M clang-tools-extra/clang-query/QuerySession.h
    M clang-tools-extra/docs/ReleaseNotes.rst

  Log Message:
  -----------
  [clang-query] add basic profiling on matching each ASTs (#114806)

We've found that basic profiling could help improving/optimizing when
developing clang-tidy checks.

This PR adds an extra command
```
set enable-profile (true|false)   Set whether to enable matcher profiling.
```
which enables profiling queries on each file.

Sample output:

```
$ cat test.cql
set enable-profile true
m binaryOperator(isExpansionInMainFile())

$ cat test.c
int test(int i, int j) {
  return i + j;
}

$ clang-query --track-memory -f test.cql test.c --

Match #1:

{{.*}}/test.c:2:10: note: "root" binds here
    2 |   return i + j;
      |          ^~~~~
1 match.
===-------------------------------------------------------------------------===
                         clang-query matcher profiling
===-------------------------------------------------------------------------===
  Total Execution Time: 0.0000 seconds (0.0000 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  ---Mem---  --- Name ---
   0.0000 (100.0%)   0.0000 (100.0%)   0.0000 (100.0%)   0.0000 (100.0%)        224  {{.*}}/test.c
   0.0000 (100.0%)   0.0000 (100.0%)   0.0000 (100.0%)   0.0000 (100.0%)        224  Total
```



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list