Skip to content

profile_cbmc.py: profile any command of CBMC's tools, also long ones - #9632

Draft
tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:kiro/profile-any-command
Draft

tautschnig wants to merge 1 commit into
diffblue:developfrom
tautschnig:kiro/profile-any-command

Conversation

@tautschnig

Copy link
Copy Markdown
Collaborator

The profiling script ran cbmc on C files only, adding --dimacs and --verbosity, and its post-processing assumed short runs: it held the output of perf script in memory (gigabytes for a run of minutes), gave perf report and perf script two minutes, and recorded DWARF call graphs (16 KiB per sample). Profiling the goto-cc compilations and goto-ld links of a large build, or goto-instrument loading a large goto binary, needed all of that to change.

  • --command profiles the command line after "--" as it is, in the directory given by --cwd, under the name given by --name. The functions of the binary it runs (symbolic links such as goto-ld resolved, so goto-cc) count as CBMC code, and that binary is used for source locations if it has debug information.
  • --call-graph fp|dwarf|lbr, --frequency, --perf-timeout and --no-inline select perf's call-graph mode (frame pointers for long runs, with a build using -fno-omit-frame-pointer), the sampling frequency, the time limit of each post-processing step, and whether perf resolves inlined frames (slow on large recordings).
  • The output of perf script is piped into stackcollapse-perf.pl, and the folded stacks are kept in stacks.folded.
  • Each run records its wall time, CPU time and maximum resident set size (of perf and the command, from wait4), shown in a new table of the summary, which also lists the functions with the most samples including their callees.
  • A run that exceeds --timeout is sent SIGINT, so that perf record stops the command and writes out the samples collected so far, rather than being killed.

Without the new options, cbmc runs are profiled as before, and their summary has the additional tables only. AGENTS.md shows an example.

  • Each commit message has a non-empty body, explaining why the change was made.
  • n/a Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • n/a The feature or user visible behaviour I have added or modified has been documented in the User Guide in doc/cprover-manual/
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • n/a White-space or formatting changes outside the feature-related changed lines are in commits of their own.

The profiling script ran cbmc on C files only, adding --dimacs and
--verbosity, and its post-processing assumed short runs: it held the
output of perf script in memory (gigabytes for a run of minutes), gave
perf report and perf script two minutes, and recorded DWARF call graphs
(16 KiB per sample). Profiling the goto-cc compilations and goto-ld links
of a large build, or goto-instrument loading a large goto binary, needed
all of that to change.

- --command profiles the command line after "--" as it is, in the
  directory given by --cwd, under the name given by --name. The functions
  of the binary it runs (symbolic links such as goto-ld resolved, so
  goto-cc) count as CBMC code, and that binary is used for source
  locations if it has debug information.
- --call-graph fp|dwarf|lbr, --frequency, --perf-timeout and --no-inline
  select perf's call-graph mode (frame pointers for long runs, with a
  build using -fno-omit-frame-pointer), the sampling frequency, the time
  limit of each post-processing step, and whether perf resolves inlined
  frames (slow on large recordings).
- The output of perf script is piped into stackcollapse-perf.pl, and the
  folded stacks are kept in stacks.folded.
- Each run records its wall time, CPU time and maximum resident set size
  (of perf and the command, from wait4), shown in a new table of the
  summary, which also lists the functions with the most samples
  including their callees.
- A run that exceeds --timeout is sent SIGINT, so that perf record stops
  the command and writes out the samples collected so far, rather than
  being killed.

Without the new options, cbmc runs are profiled as before, and their
summary has the additional tables only. AGENTS.md shows an example.

Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
@codecov

codecov Bot commented Dec 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.34%. Comparing base (3e1f386) to head (554e426).
⚠️ Report is 36 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #9632      +/-   ##
===========================================
+ Coverage    81.29%   81.34%   +0.04%     
===========================================
  Files         1725     1727       +2     
  Lines       191680   191715      +35     
  Branches        73       73              
===========================================
+ Hits        155835   155951     +116     
+ Misses       35845    35764      -81     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant