rust-lang / rust-lang/rustc-perf
[Windows] Implement support for the `cpu-clock` perf pseudo-counter
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 732
- Forks
- 189
- Avg merge
- 10h 52m
- Merged PRs (30d)
- 43
Description
The Linux perf tool has a counter called cpu-clock which is basically just the total time the process was running on each thread. (As a simple example, suppose a process runs for 3 seconds on 1 core and, at the same time, 1 second on another core, then the cpu-clock would read 4 seconds)
This counter isn't backed by a hardware performance counter, rather it is a metric derived from some hardware performance counters and as such, doesn't exist on Windows. However, we can replicate the counter ourselves.
To do that, we'll need to keep track of the times each thread we care about spends active on a core and sum the total times together. We may be able to use the Timestamp data already collected in the trace file for this purpose or we may need to use the Time (or TimerFixed?) PMC.
After this is implemented, the detailed self-profile query results page should show reasonable numbers in the total "Time %" cell.

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked sections of collector/src/etw_parser.rs around lines 384-388 and 398-399, then trace how the Windows ETW data reaches the detailed self-profile query results page. Determine how the existing Timestamp, Time, or TimerFixed data relates to per-thread active time. Done means the page shows reasonable values in the total "Time %" cell for Windows profiles.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100