Skip to content

Only treat the main event's period as CPU time for clock events - #889

Draft
antiguru wants to merge 1 commit into
mstange:mainfrom
antiguru:cpu-delta-clock-events
Draft

antiguru wants to merge 1 commit into
mstange:mainfrom
antiguru:cpu-delta-clock-events

Conversation

@antiguru

Copy link
Copy Markdown

Without context-switch records, samply import writes each main-event sample's period into threadCPUDelta as nanoseconds, whatever the event. For perf record -e cycles, this puts cycle counts into the CPU graph as if they were time.

The period now becomes the CPU delta only when the main event is cpu-clock or task-clock. Other main events get a CPU delta of 0.

This changes the Firefox Profiler's CPU graph for imports of non-clock events without context switches: it shows no CPU data instead of wrong values. Imports with context switches and samply record are unchanged. The profile interval is unchanged in all cases.

cpu-clock and task-clock events could not be recorded on the test machine ("Bad event name"), so the clock branch is covered by the unit test only.

Posted by Claude Code.

🤖 Generated with Claude Code

https://claude.ai/code/session_016aEc8uf7GZbHQHXmoX8o2k

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