Re: [PATCH RFC 1/3] perf/core: add logic to collect off-cpu sample

From: Ajay Kaher
Date: Sun Jul 14 2024 - 12:23:39 EST


On Fri, Jul 12, 2024 at 3:19 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Thu, Jul 11, 2024 at 05:46:17PM +0530, Ajay Kaher wrote:
> > following logics has been added to collect the off-cpu sample:
> >
> > - 'task_pt_regs(current)' has been used to capture registers
> > status off-cpu sample.
> >
> > - off-cpu time represent the time period for which the target
> > process not occupying the cpu cycles. And calculate as:
> >
> > off-cpu time = swap-in time - swap-out time
> >
>
> I have absolutely no idea what you're trying to do :/ The above does not
> constitute a comprehensible Changelog.

Sorry Peter, it’s sched-in/out (not swap-in/out).

'Perf record' captures on-cpu samples at frequency which is specified by
the user ( i.e. time period to collect sample is NSEC_PER_SEC / freq).

This patch is to collect the off_cpu sample and time period of off_cpu
sample is calculated based upon the time when target task was sched_out
to sched_in, as:

off-cpu time period = sched_in time - sched-out time

-Ajay