Re: [PATCH 1/3] perf tools: Record total sampling time

From: Namhyung Kim
Date: Mon Dec 02 2013 - 10:06:11 EST


Hi Ingo,

2013-12-02 (ì), 13:45 +0100, Ingo Molnar:
> * Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
>
> > From: Namhyung Kim <namhyung.kim@xxxxxxx>
> >
> > It's sometimes useful to see total sampling or elapsed time with
> > normal performance result. To do that, record first and last sample
> > time for each evsel and to display it in the header (--stdio only for
> > now).
> >
> > $ perf record -a sleep 1
> > $ perf report --stdio
> > ...
> > # Samples: 4K of event 'cycles'
> > # Event count (approx.): 4087481688
> > # Total sampling time : 1.001260 (sec)
>
> Btw., would it make sense to output it using the 'perf stat' print-out
> machinery?
>
> If the 'count' of every event sampled is saved in the perf.data,
> including elapsed time, at the beginning and at the end, then all
> information is there to output things in perf stat style.

Yeah, it'd be great if we can share same code in the end.

>
> ( It might even make sense to save two more timestamps: rusage stime
> and utime - that way the output could be made /usr/bin/time-alike. )

Hmm.. I think I can do it by adding time info according to a cpumode in
a sample.

>
> Also I think there is some related existing functionality, I think
> Stephane added a way to essentially do non-sampling 'perf stat' via
> perf record - but the details escape me, I think it was related to the
> -n option?

I have no idea about the perf record -n/--no-samples option. It looks
like something related to task stat?

commit 649c48a9e7fafcc72bfcc99471d9dea98d789d59
Author: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Date: Wed Jun 24 21:12:48 2009 +0200

perf-report: Add modes for inherited stats and no-samples

Now that we can collect per task statistics, add modes that
make use of that facility.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
LKML-Reference: <new-submission>
Signed-off-by: Ingo Molnar <mingo@xxxxxxx>


But everytime I tried to use it, perf report always complained about the
file has no samples.. :-/

>
> So what we want here is in essence a sampling mode that can record and
> report all the absolute counts as well.

Agreed.

Thanks,
Namhyung


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/