[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220423121557.z5gzbqadonmrg6ef@pasture>
Date: Sat, 23 Apr 2022 14:15:57 +0200
From: Florian Fischer <florian.fischer@...q.space>
To: Namhyung Kim <namhyung@...il.com>
Cc: Arnaldo Carvalho de Melo <acme@...nel.org>,
linux-perf-users <linux-perf-users@...r.kernel.org>,
Ian Rogers <irogers@...gle.com>,
Xing Zhengjun <zhengjun.xing@...ux.intel.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCHSET v4 next 0/3] perf stat: add user_time and system_time
tool events
On 22.04.2022 16:52, Namhyung Kim wrote:
> Hello,
>
> On Fri, Apr 22, 2022 at 3:05 PM Arnaldo Carvalho de Melo
> <acme@...nel.org> wrote:
> >
> > Em Wed, Apr 20, 2022 at 12:23:51PM +0200, Florian Fischer escreveu:
> > > This patch series adds new internal events to perf stat exposing the times spend
> > > in user and kernel mode in nanoseconds reported by rusage.
> > >
> > > During some benchmarking using perf it bothered me that I could not easily
> > > retrieve those times from perf stat when using the machine readable output.
> > >
> > > But perf definitely knows about those values because in the human readable output
> > > they are present.
> > >
> > > Therefore I exposed the times reported by rusage via the new tool events:
> > > user_time and system_time.
> > >
> > > This allows to retrieved them in machine-readable output:
> > >
> > > $ ./perf stat -x, -e duration_time,user_time,system_time,cache-misses -- grep -q -r duration_time tools/perf
> > > 72134524,ns,duration_time:u,72134524,100.00,,
> > > 65225000,ns,user_time:u,65225000,100.00,,
> > > 6865000,ns,ssystem_time:u,6865000,100.00,,
>
> ssystem? Looks like a typo.
Yes thanks. Fortunately I fixed it in the commit that got applied [1].
>
> Anyway it looks a little bit strange to me if we can get
> system time in user mode only (the 'u' modifier).
Sorry but I don't really understand what you mean.
The system_time is reported to userspace via rusage filled by wait4(2).
It will always report the value reported to the user space regardless of what
counters perf has access to.
If you run perf as user you get the same system_time (but with the ':u' suffix)
as when you run perf as root or lower kernel.perf_event_paranoid to allow access
to more counters.
$ perf stat -x, -e system_time sync
31246000,ns,system_time:u,31246000,100.00,,
# perf stat -x, -e system_time sync
33794000,ns,system_time,33794000,100.00,,
>
> Thanks,
> Namhyung
>
Flo Fischer
[1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=tmp.perf/core&id=b03b89b350034f220cc24fc77c56990a97a796b2
Powered by blists - more mailing lists