Commit Graph

27 Commits

Author SHA1 Message Date
Tyler Yankee
bf52fbfbc4 instrumentation: Add Google trace output
Add a feature to parse snippets into a trace file compatible with the
Google Trace Event Format.

Fixes: #26674
2025-09-03 15:24:10 -04:00
Martin Duffy
e6b37105ba instrumentation: Collect custom content from CMake configure
Add a `CUSTOM_CONTENT` argument to `cmake_instrumentation()` for collecting
custom content from configure time.

Snippet files include a reference to a JSON file containing any `CUSTOM_CONTENT`
that was added by this command.

Fixes: #26703
2025-08-21 07:20:12 -04:00
Martin Duffy
a249e820a8 instrumentation: Add file lock for build daemon
Prevent starting instrumentation build daemon and related hooks if one is
already running, and when during `cmake --build`.
2025-08-06 11:45:40 -04:00
Tyler Yankee
455944508e instrumentation: Remove ninja-specific references
Amend commit 314440c320 (instrumentation: Run preBuild and postBuild
hooks before and after make, 2025-02-05) to make comments and variables
names in `cmInstrumentation` agnostic to the build system being used.
2025-07-22 10:51:15 -04:00
Tyler Yankee
7dbe092d77 instrumentation: Support preBuild and postBuild hooks on Windows
* Use `uv_disable_stdio_inheritance` to resolve the deadlock between the
parent build system process and `ctest
--wait-and-collect-instrumentation` on Windows.
* Remove Windows gating from preBuild and postBuild indexing and update
tests and documentation accordingly.

Fixes: #26668
2025-07-22 10:51:03 -04:00
Martin Duffy
9dec460c8c instrumentation: Store CDash settings in query files
Adds new `cdashSubmit` and `cdashVerbose` options to allow enabling
instrumentation in CDash submissions using query files or the
`cmake_instrumentation` command.

Fixes: #26783, #26727
2025-07-14 15:44:52 -04:00
Martin Duffy
afa94bae1e instrumentation: Rename queries field to options
Fixes: #26728
2025-07-10 16:25:07 -04:00
Brad King
ed8513783c Merge topic 'instrumentation-fix'
e01d12c14f instrumentation: Prevent unnecessary query loading
f26f127183 instrumentation: Reuse single cmsys::SystemInformation

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !10863
2025-06-10 09:48:17 -04:00
Martin Duffy
e01d12c14f instrumentation: Prevent unnecessary query loading
Don't load queries from instrumentation directories when GetIsInTryCompile
or before ClearGeneratedQueries from previous configures has run.
2025-06-09 11:33:24 -04:00
Martin Duffy
f26f127183 instrumentation: Reuse single cmsys::SystemInformation 2025-06-09 11:33:18 -04:00
Ben Boeckel
557c44b93e cmStrCat: use character literals where possible
Found and replaced using the `cmstrcat-to-char-literal` rule for
`ast-grep`.
2025-05-15 19:12:04 +02:00
Brad King
deb44bdf73 Merge topic 'instrumentation-snippet-names'
39f365ec3c instrumentation: Unique snippet file names

Acked-by: Kitware Robot <kwrobot@kitware.com>
Tested-by: buildbot <buildbot@kitware.com>
Merge-request: !10491
2025-03-19 09:05:56 -04:00
Martin Duffy
39f365ec3c instrumentation: Unique snippet file names
Updates the hash in snippet file naming to take the ProcessId into account
so that snippets with identical commands don't risk a collision in filename.

Additionally, this adds a `workingDir` to snippet files so that snippets with
identical commands can be more easily differentiated, such as with install
snippets.
2025-03-18 13:23:02 -04:00
Brad King
2604f5d8b3 Merge topic 'json-errors-filename'
f134468a98 JSON: Improve JSON error message formatting

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10463
2025-03-14 12:17:02 -04:00
Martin Duffy
f134468a98 JSON: Improve JSON error message formatting
This improves the output of JSON-related error messages. It adds the filename to
the output and excludes the column number.

This is particularly useful when there are multiple JSON files being read that
could be responsible for an error, ie CMakePresets.json and
CMakeUserPresets.json, or multiple instrumentation queries.

Issue: #26717
2025-03-13 10:44:31 -04:00
Martin Duffy
4e7b37cad3 instrumentation: Quote command arguments to preserve separation
Fixes: #26702
2025-02-24 13:11:19 -05:00
Zack Galbreath
a6d4a9a2ae ctest: Include cmake instrumentation data in XML files 2025-02-15 06:25:12 -05:00
Martin Duffy
2299b2fcab instrumentation: Add build snippet
Adds a new snippet generation for recording the full time spent waiting for
`ninja` or `make` invocations to finish.
2025-02-11 13:31:28 -05:00
Martin Duffy
32e9d27c88 instrumentation: Remove undocumented binaryDir field from snippets
Removes field from snippet files redundant with the index file's "buildDir"
2025-02-10 17:19:10 -05:00
Martin Duffy
9689155a05 instrumentation: Add Config value to snippet data 2025-02-09 12:29:09 -05:00
Martin Duffy
6598248da7 instrumentation: Avoid busy-wait on postBuild hook 2025-02-06 07:46:09 -05:00
Martin Duffy
2680f30caf instrumentation: Allow multiple CALLBACK arguments
Don't require quotes around CALLBACK argument and allow it to be passed
multiple times.
2025-02-04 11:15:20 -05:00
Martin Duffy
fc1d55f6a5 instrumentation: Add preBuild and postBuild hooks for ninja
Allows instrumentation indexing and callbacks to occur at the start or end of
every `ninja` invocation.
2025-02-04 11:15:11 -05:00
Martin Duffy
f62a4ab2ee instrumentation: Refactor cmInstrumentation constructor and usage
Creates a global cmInstrumentation pointer on the CMake Instance to
prevent creating multiple instrumentation objects.
2025-02-03 10:10:06 -05:00
Kitware Robot
0b96ae1f6a Revise C++ coding style using clang-format with "east const"
Run the `clang-format.bash` script to update all our C and C++ code to a
new style defined by `.clang-format`, now with "east const" enforcement.
Use `clang-format` version 18.

* If you reached this commit for a line in `git blame`, re-run the blame
  operation starting at the parent of this commit to see older history
  for the content.

* See the parent commit for instructions to rebase a change across this
  style transition commit.

Issue: #26123
2025-01-23 13:09:50 -05:00
Martin Duffy
9d34069ca8 instrumentation: Add targetLabels field to link snippets
Adds a new data field `targetLabels` to link snippets which contains a list of
text labels from the LABELS target property.
2025-01-17 11:07:30 -05:00
Martin Duffy
097d4fd1b5 instrumentation: Collect and record project build system metrics
Add a feature for collecting build instrumentation for CMake projects.

Issue: #26099
2025-01-15 09:16:50 -05:00