Skip to content
Snippets Groups Projects

instrumentation: Collect and record project build system metrics

Merged Martin Duffy requested to merge martin.duffy/cmake:instrumentation into master

See these example scripts to test this feature on an existing CMake project.

For testing, this is the current expected query format (lives in <CMAKE_CONFIG_DIR>/timing/v1/query/*.json or <CMAKE_BINARY_DIR>/timing/v1/query/*.json:

{
  "queries": [ // optional, will still gather basic timing + target data if absent
    "staticSystemInformation", // gathers static system info in index files
    "dynamicSystemInformation" // gathers dynamic system info before/after each command
  ],
  "hooks": [ // optional, runs indexing and callbacks automatically at given intervals
    "preConfigure", "postGenerate", "preCMakeBuild", "postCMakeBuild", "postTest", "postInstall"
  ],
  "callbacks": [ // optional, callbacks to run after indexing
    "/path/to/my/script" // executes as "/path/to/my/script /full/path/to/index-<timestamp>-<hash>.json"
  ]
}

Here is what the example output would look like for one compile command

{
  "version": 1,
  "command" : "/usr/bin/c++ -MD -MT CMakeFiles/main.dir/main.cxx.o -MF CMakeFiles/main.dir/main.cxx.o.d -o CMakeFiles/main.dir/main.cxx.o -c <src>/main.cxx",
  "role" : "compile",
  "result" : 1,
  "target": "main",
  "language" : "C++",
  "outputs" : [ "CMakeFiles/main.dir/main.cxx.o" ],
  "outputSizes" : [ 0 ],
  "source" : "<src>/main.cxx",
  "dynamicSystemInformation" :
  {
    "afterCPULoadAverage" : 2.3500000000000001,
    "afterHostMemoryUsed" : 6635680.0
    "beforeCPULoadAverage" : 2.3500000000000001,
    "beforeHostMemoryUsed" : 6635832.0
  },
  "timeStart" : 31997009,
  "duration" : 56
}

Not included in this initial merge request

  1. Hooks before/after invocations of the build tool (make or ninja). There is significant complexity around implementing this so I will include it in a following MR.

  2. Ability to submit data to CDash @zackgalbreath is working on this and will open a followup once this work is merged.

The documentation in this MR includes only the functionality currently included, so it excludes both of these.


Issue: #26099 (closed)

Edited by Brad King

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading