2011-03-15 14:04:13 +00:00
|
|
|
/*
|
|
|
|
* Builtin evlist command: Show the list of event selectors present
|
|
|
|
* in a perf.data file.
|
|
|
|
*/
|
|
|
|
#include "builtin.h"
|
|
|
|
|
|
|
|
#include "util/util.h"
|
|
|
|
|
|
|
|
#include <linux/list.h>
|
|
|
|
|
|
|
|
#include "perf.h"
|
|
|
|
#include "util/evlist.h"
|
|
|
|
#include "util/evsel.h"
|
|
|
|
#include "util/parse-events.h"
|
|
|
|
#include "util/parse-options.h"
|
|
|
|
#include "util/session.h"
|
|
|
|
|
2012-10-30 03:56:02 +00:00
|
|
|
static int __cmd_evlist(const char *file_name, struct perf_attr_details *details)
|
2011-03-15 14:04:13 +00:00
|
|
|
{
|
|
|
|
struct perf_session *session;
|
|
|
|
struct perf_evsel *pos;
|
|
|
|
|
2012-10-30 03:56:02 +00:00
|
|
|
session = perf_session__new(file_name, O_RDONLY, 0, false, NULL);
|
2011-03-15 14:04:13 +00:00
|
|
|
if (session == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
2012-12-10 21:17:08 +00:00
|
|
|
list_for_each_entry(pos, &session->evlist->entries, node)
|
|
|
|
perf_evsel__fprintf(pos, details, stdout);
|
2011-03-15 14:04:13 +00:00
|
|
|
|
|
|
|
perf_session__delete(session);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-09-10 22:15:03 +00:00
|
|
|
int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
|
2011-03-15 14:04:13 +00:00
|
|
|
{
|
perf evlist: Show event attribute details
There was no easy way to see the frequency used, and with the change of
default, we better provide one.
[root@sandy linux]# perf evlist -F
cycles: sample_freq=4000
[root@sandy linux]# perf evlist -v
cycles: sample_freq=4000, size: 80, sample_type: 391, read_format: 7, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
[root@sandy linux]#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-e1p9poez3nwrgycbmwqmhlsu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-22 17:30:11 +00:00
|
|
|
struct perf_attr_details details = { .verbose = false, };
|
|
|
|
const struct option options[] = {
|
2012-10-01 18:20:58 +00:00
|
|
|
OPT_STRING('i', "input", &input_name, "file", "Input file name"),
|
|
|
|
OPT_BOOLEAN('F', "freq", &details.freq, "Show the sample frequency"),
|
|
|
|
OPT_BOOLEAN('v', "verbose", &details.verbose,
|
|
|
|
"Show all event attr details"),
|
2013-02-06 20:20:02 +00:00
|
|
|
OPT_BOOLEAN('g', "group", &details.event_group,
|
2013-01-22 09:09:47 +00:00
|
|
|
"Show event group information"),
|
2012-10-01 18:20:58 +00:00
|
|
|
OPT_END()
|
|
|
|
};
|
|
|
|
const char * const evlist_usage[] = {
|
|
|
|
"perf evlist [<options>]",
|
|
|
|
NULL
|
perf evlist: Show event attribute details
There was no easy way to see the frequency used, and with the change of
default, we better provide one.
[root@sandy linux]# perf evlist -F
cycles: sample_freq=4000
[root@sandy linux]# perf evlist -v
cycles: sample_freq=4000, size: 80, sample_type: 391, read_format: 7, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
[root@sandy linux]#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-e1p9poez3nwrgycbmwqmhlsu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-22 17:30:11 +00:00
|
|
|
};
|
|
|
|
|
2011-03-15 14:04:13 +00:00
|
|
|
argc = parse_options(argc, argv, options, evlist_usage, 0);
|
|
|
|
if (argc)
|
|
|
|
usage_with_options(evlist_usage, options);
|
|
|
|
|
2013-02-06 20:20:02 +00:00
|
|
|
if (details.event_group && (details.verbose || details.freq)) {
|
2013-01-22 09:09:47 +00:00
|
|
|
pr_err("--group option is not compatible with other options\n");
|
|
|
|
usage_with_options(evlist_usage, options);
|
|
|
|
}
|
|
|
|
|
perf evlist: Show event attribute details
There was no easy way to see the frequency used, and with the change of
default, we better provide one.
[root@sandy linux]# perf evlist -F
cycles: sample_freq=4000
[root@sandy linux]# perf evlist -v
cycles: sample_freq=4000, size: 80, sample_type: 391, read_format: 7, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
[root@sandy linux]#
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-e1p9poez3nwrgycbmwqmhlsu@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2012-05-22 17:30:11 +00:00
|
|
|
return __cmd_evlist(input_name, &details);
|
2011-03-15 14:04:13 +00:00
|
|
|
}
|