summaryrefslogtreecommitdiff
path: root/tools/perf/builtin-evlist.c
diff options
context:
space:
mode:
authorSrikant Patnaik2015-01-13 15:08:24 +0530
committerSrikant Patnaik2015-01-13 15:08:24 +0530
commit97327692361306d1e6259021bc425e32832fdb50 (patch)
treefe9088f3248ec61e24f404f21b9793cb644b7f01 /tools/perf/builtin-evlist.c
parent2d05a8f663478a44e088d122e0d62109bbc801d0 (diff)
parenta3a8b90b61e21be3dde9101c4e86c881e0f06210 (diff)
downloadFOSSEE-netbook-kernel-source-97327692361306d1e6259021bc425e32832fdb50.tar.gz
FOSSEE-netbook-kernel-source-97327692361306d1e6259021bc425e32832fdb50.tar.bz2
FOSSEE-netbook-kernel-source-97327692361306d1e6259021bc425e32832fdb50.zip
dirty fix to merging
Diffstat (limited to 'tools/perf/builtin-evlist.c')
-rw-r--r--tools/perf/builtin-evlist.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/tools/perf/builtin-evlist.c b/tools/perf/builtin-evlist.c
new file mode 100644
index 00000000..26760322
--- /dev/null
+++ b/tools/perf/builtin-evlist.c
@@ -0,0 +1,54 @@
+/*
+ * 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"
+
+static const char *input_name;
+
+static int __cmd_evlist(void)
+{
+ struct perf_session *session;
+ struct perf_evsel *pos;
+
+ session = perf_session__new(input_name, O_RDONLY, 0, false, NULL);
+ if (session == NULL)
+ return -ENOMEM;
+
+ list_for_each_entry(pos, &session->evlist->entries, node)
+ printf("%s\n", event_name(pos));
+
+ perf_session__delete(session);
+ return 0;
+}
+
+static const char * const evlist_usage[] = {
+ "perf evlist [<options>]",
+ NULL
+};
+
+static const struct option options[] = {
+ OPT_STRING('i', "input", &input_name, "file",
+ "input file name"),
+ OPT_END()
+};
+
+int cmd_evlist(int argc, const char **argv, const char *prefix __used)
+{
+ argc = parse_options(argc, argv, options, evlist_usage, 0);
+ if (argc)
+ usage_with_options(evlist_usage, options);
+
+ return __cmd_evlist();
+}