[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALCETrVaZjVbXaCFikiNBOGOn-ia65g+xUGHNLgQ3D+=_SgFKg@mail.gmail.com>
Date: Mon, 27 Jul 2015 10:40:43 -0700
From: Andy Lutomirski <luto@...capital.net>
To: Jiri Olsa <jolsa@...hat.com>
Cc: Namhyung Kim <namhyung@...nel.org>,
David Ahern <dsahern@...il.com>,
Adrian Hunter <adrian.hunter@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Mark Rutland <mark.rutland@....com>,
Kan Liang <kan.liang@...el.com>, Jiri Olsa <jolsa@...nel.org>,
Andi Kleen <ak@...ux.intel.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Stephane Eranian <eranian@...gle.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Ingo Molnar <mingo@...hat.com>
Subject: Re: [PATCH RFC V2 1/1] x86, perf: Add a freq pmu driver
On Jul 26, 2015 9:31 AM, "Jiri Olsa" <jolsa@...hat.com> wrote:
>
> On Mon, Jul 20, 2015 at 11:49:06AM -0400, Kan Liang wrote:
> > From: Andy Lutomirski <luto@...nel.org>
> >
> > This patch adds freq PMU to support time and freq related counters
> > includes TSC, IA32_APERF, IA32_MPERF and IA32_PPERF.
> >
> > The events are exposed in sysfs for use by perf stat and other tools.
> > The files are under /sys/devices/freq/events/
> >
> > These events only support system-wide mode counting.
> >
> > The PMU type (attr->type) is PERF_TYPE_FREQ.
> >
> > Example:
> >
> > To caculate the CPU%
> > CPU_Utilization = CPU_CLK_UNHALTED.REF_TSC / TSC
> >
> > $ perf stat -e '{ref-cycles,freq/tsc/}' -C0 -- taskset -c 0 sleep 1
> > 3164023,,ref-cycles,1048387386,100.00
> > 2410812089,,freq/tsc/,1050022373,100.00
> > The CPU% for sleep is 0.13%.
> >
> > $ perf stat -e '{ref-cycles,freq/tsc/}' -C0 -- taskset -c 0 busyloop
> > 15662183572,,ref-cycles,6822637855,100.00
> > 15667608992,,freq/tsc/,6823978523,100.00
> > The CPU% for busy loop is 99.9%.
> >
> > Signed-off-by: Andy Lutomirski <luto@...nel.org>
> > Signed-off-by: Kan Liang <kan.liang@...el.com>
>
> SNIP
>
> > diff --git a/arch/x86/kernel/cpu/perf_event_freq.c b/arch/x86/kernel/cpu/perf_event_freq.c
> > new file mode 100644
> > index 0000000..9389b3b
> > --- /dev/null
> > +++ b/arch/x86/kernel/cpu/perf_event_freq.c
> > @@ -0,0 +1,207 @@
> > +#include <linux/perf_event.h>
> > +
> > +enum perf_freq_id {
> > + /*
> > + * freq events, generalized by the kernel:
> > + */
> > + PERF_FREQ_TSC = 0,
> > + PERF_FREQ_APERF = 1,
> > + PERF_FREQ_MPERF = 2,
> > + PERF_FREQ_PPERF = 3,
> > +
> > + PERF_FREQ_EVENT_MAX, /* non-ABI */
>
> should this be in uapi header?
Possibly not, since user code can fish them out of sysfs.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists