Re: [RFC 4/4] perf sched schedstat: Add support for report subcommand

From: Chen Yu
Date: Sat May 11 2024 - 03:46:24 EST


On 2024-05-08 at 11:34:27 +0530, Ravi Bangoria wrote:
> From: Swapnil Sapkal <swapnil.sapkal@xxxxxxx>
>
> `perf sched schedstat record` captures two sets of samples. For workload
> profile, first set right before workload starts and second set after
> workload finishes. For the systemwide profile, first set at the beginning
> of profile and second set on receiving SIGINT signal.
>
> Add `perf sched schedstat report` subcommand that will read both the set
> of samples, get the diff and render a final report. Final report prints
> scheduler stat at cpu granularity as well as sched domain granularity.
>
> Usage example:
>
> # perf sched schedstat record
> # perf sched schedstat report
>
> Co-developed-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
> Signed-off-by: Swapnil Sapkal <swapnil.sapkal@xxxxxxx>
> Signed-off-by: Ravi Bangoria <ravi.bangoria@xxxxxxx>
>

I've tested it on a 240 CPUs Xeon system and it looks very useful. Thanks!

1. Just to confirm, if we want to add new fields for debugging purpose,
schedstat-domain-v1x.h and schedstat-cpu-v1x.h are the only files to
be touched, right?
2. Although we can filter the output, is it applicable to only track some
CPUs? Like perf sched schedstat -C 4 record

thanks,
Chenyu