tools: perf: build in perf periodic

Add perf periodic to the list of perf commands.
Get it to compile with latest kernel and add documentation.

Change-Id: Ie250697f36d1691596196119c1e0a76ada524dc8
Signed-off-by: Neil Leeder <nleeder@codeaurora.org>
This commit is contained in:
Neil Leeder 2013-11-14 15:23:56 -05:00
parent 60e6ad84d7
commit 88fad559c1
3 changed files with 80 additions and 3 deletions

View File

@ -0,0 +1,76 @@
perf-periodic(1)
============
NAME
----
perf-periodic - Periodically print the performance counters at given rate
SYNOPSIS
--------
[verse]
'perf periodic' [-e <EVENT> | --event=EVENT] [-p pid] [<options>]
DESCRIPTION
-----------
This command gathers performance counter statistics and periodically prints
out the counter values.
OPTIONS
-------
-e::
--event=::
Select the PMU event. Selection can be a symbolic event name
(use 'perf list' to list all events) or a raw PMU
event (eventsel+umask) in the form of rNNN where NNN is a
hexadecimal event descriptor.
-a::
--all-cpus::
system-wide collection from all CPUs, overrides cpumask
-c cpumask::
Count only on the list of CPUs provided. Multiple CPUs can be provided as a
mask: 1 = cpu0, 3 = cpu0 and cpu1 etc. Default is to count on all CPUs.
-d::
Delta. Display results as a delta from the previous value. Default is to
show the total acculumated value.
-i iterations::
Number of times to iterate. Default 0-forever.
-m operations::
Perform math operations on results. m=multiply, d=divide, a=add, s=subtract,
z=zero, t=transfer, T=total.
-p::
--pid=<pid>::
stat events on existing process id (comma separated list)
-r fifo_name::
Specify read FIFO name for commands, such as PID to pass pid to connect to.
-s delay::
Time to sleep between each sample, in milliseconds. Default 1000 (1 second).
-v::
Verbose. Show more information (counter open errors etc).
EXAMPLES
--------
$ perf periodic -d -e r3 -e r4 -i 3
122640 2570103
108397 2159418
133372 2826949
$ perf periodic -d -e r3 -e r4 -i 3 -m td
0.032174
0.050263
0.031349
SEE ALSO
--------
linkperf:perf-stat[1]

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2012, The Linux Foundation. All rights reserved.
* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@ -335,7 +335,7 @@ static void do_math_op(struct perf_setup_s *p)
}
}
int cmd_periodic(int argc, const char **argv, const char *prefix __used)
int cmd_periodic(int argc, const char **argv, const char *prefix __maybe_unused)
{
int status = 0;
int c, i;
@ -344,7 +344,7 @@ int cmd_periodic(int argc, const char **argv, const char *prefix __used)
FILE *fp;
int nr_counters = 0;
evsel_list = perf_evlist__new(NULL, NULL);
evsel_list = perf_evlist__new();
if (evsel_list == NULL)
return -ENOMEM;

View File

@ -15,6 +15,7 @@ perf-kvm mainporcelain common
perf-list mainporcelain common
perf-lock mainporcelain common
perf-mem mainporcelain common
perf-periodic mainporcelain common
perf-probe mainporcelain full
perf-record mainporcelain common
perf-report mainporcelain common