Add Frontend.NumInstructions statistic, populated on macOS by rusage_info_v4 #18658
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
After all the fussing around I have done trying to get a reliable external tool to read off the PMC instruction counts for a subprocess tree on macOS (a la linux perf(1)) I was somewhat astonished to learn that XNU these days just always tracks every task's PMC-read instruction count (see: https://github.com/apple/darwin-xnu/blob/master/osfmk/kern/kern_monotonic.c and https://github.com/apple/darwin-xnu/blob/master/osfmk/x86_64/monotonic_x86_64.c) and returns it as a standard field in its rusage_info_v4 structure, if you ask via proc_pid_rusage.
So: this patch adds instruction counts to UnifiedStatsCollector / -stats-output-dir. I will be plumbing it through everything else subsequently -- it's a much less-noisy number to use than the time values, while being a decent proxy for it at the granularity we're concerned with -- but this gets the ball rolling.