From: Jiri Olsa <jolsa@redhat.com>
To: Kan Liang <kan.liang@intel.com>
Cc: a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org,
eranian@google.com, ak@linux.intel.com, mark.rutland@arm.com,
adrian.hunter@intel.com, dsahern@gmail.com, jolsa@kernel.org,
namhyung@kernel.org, linux-kernel@vger.kernel.org,
Andy Lutomirski <luto@kernel.org>
Subject: Re: [PATCH RFC V2 1/1] x86, perf: Add a freq pmu driver
Date: Sun, 26 Jul 2015 18:31:01 +0200 [thread overview]
Message-ID: <20150726163101.GA24646@krava.brq.redhat.com> (raw)
In-Reply-To: <1437407346-31186-1-git-send-email-kan.liang@intel.com>
On Mon, Jul 20, 2015 at 11:49:06AM -0400, Kan Liang wrote:
> From: Andy Lutomirski <luto@kernel.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@kernel.org>
> Signed-off-by: Kan Liang <kan.liang@intel.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?
jirka
next prev parent reply other threads:[~2015-07-26 16:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-20 15:49 [PATCH RFC V2 1/1] x86, perf: Add a freq pmu driver Kan Liang
2015-07-21 3:10 ` Stephane Eranian
2015-07-21 6:01 ` Andy Lutomirski
2015-07-21 6:21 ` Stephane Eranian
2015-07-21 6:23 ` Andy Lutomirski
2015-07-21 9:55 ` Peter Zijlstra
2015-07-21 9:55 ` Peter Zijlstra
2015-07-23 15:44 ` Stephane Eranian
2015-07-23 15:52 ` Andy Lutomirski
2015-07-23 16:00 ` Stephane Eranian
2015-07-23 17:25 ` Andi Kleen
2015-07-26 16:31 ` Jiri Olsa [this message]
2015-07-27 17:40 ` Andy Lutomirski
2015-08-04 9:01 ` [tip:perf/core] perf/x86: Add an MSR PMU driver tip-bot for Andy Lutomirski
2015-08-04 14:50 ` Andy Lutomirski
2015-08-04 15:03 ` Liang, Kan
2015-08-04 18:00 ` Andy Lutomirski
2015-08-04 18:11 ` Liang, Kan
2015-08-04 18:13 ` Andy Lutomirski
2015-08-04 20:39 ` Liang, Kan
2015-08-06 15:21 ` Peter Zijlstra
2015-08-06 15:30 ` Andy Lutomirski
2015-08-06 15:59 ` Peter Zijlstra
2015-08-07 8:34 ` Peter Zijlstra
2015-08-10 2:12 ` Andy Lutomirski
2015-08-10 14:02 ` Liang, Kan
2015-08-10 14:24 ` Peter Zijlstra
2015-08-06 17:44 ` Liang, Kan
2015-08-10 11:19 ` Jiri Olsa
2015-08-10 11:42 ` Peter Zijlstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150726163101.GA24646@krava.brq.redhat.com \
--to=jolsa@redhat.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=dsahern@gmail.com \
--cc=eranian@google.com \
--cc=jolsa@kernel.org \
--cc=kan.liang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox