mirror of
https://github.com/torvalds/linux.git
synced 2024-11-11 06:31:49 +00:00
f5fc14124c
This patch is adding 'struct perf_data_file' object as a placeholder for all attributes regarding perf.data file handling. Changing perf_session__new to take it as an argument. The rest of the functionality will be added later to keep this change simple enough, because all the places using perf_session are changed now. Signed-off-by: Jiri Olsa <jolsa@redhat.com> Acked-by: Namhyung Kim <namhyung@kernel.org> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com> Cc: David Ahern <dsahern@gmail.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/1381847254-28809-2-git-send-email-jolsa@redhat.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
67 lines
1.7 KiB
C
67 lines
1.7 KiB
C
/*
|
|
* 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"
|
|
#include "util/data.h"
|
|
|
|
static int __cmd_evlist(const char *file_name, struct perf_attr_details *details)
|
|
{
|
|
struct perf_session *session;
|
|
struct perf_evsel *pos;
|
|
struct perf_data_file file = {
|
|
.path = file_name,
|
|
.mode = PERF_DATA_MODE_READ,
|
|
};
|
|
|
|
session = perf_session__new(&file, 0, NULL);
|
|
if (session == NULL)
|
|
return -ENOMEM;
|
|
|
|
list_for_each_entry(pos, &session->evlist->entries, node)
|
|
perf_evsel__fprintf(pos, details, stdout);
|
|
|
|
perf_session__delete(session);
|
|
return 0;
|
|
}
|
|
|
|
int cmd_evlist(int argc, const char **argv, const char *prefix __maybe_unused)
|
|
{
|
|
struct perf_attr_details details = { .verbose = false, };
|
|
const struct option options[] = {
|
|
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"),
|
|
OPT_BOOLEAN('g', "group", &details.event_group,
|
|
"Show event group information"),
|
|
OPT_END()
|
|
};
|
|
const char * const evlist_usage[] = {
|
|
"perf evlist [<options>]",
|
|
NULL
|
|
};
|
|
|
|
argc = parse_options(argc, argv, options, evlist_usage, 0);
|
|
if (argc)
|
|
usage_with_options(evlist_usage, options);
|
|
|
|
if (details.event_group && (details.verbose || details.freq)) {
|
|
pr_err("--group option is not compatible with other options\n");
|
|
usage_with_options(evlist_usage, options);
|
|
}
|
|
|
|
return __cmd_evlist(input_name, &details);
|
|
}
|