From 5d8bb1ec7477e0e53dbd891733682a6583d4398e Mon Sep 17 00:00:00 2001 From: Mathieu Poirier Date: Fri, 16 Sep 2016 09:50:03 -0600 Subject: perf tools: Add PMU configuration to tools Now that the required mechanic is there to deal with PMU specific configuration, add the functionality to the tools where events can be selected. Signed-off-by: Mathieu Poirier Acked-by: Jiri Olsa Cc: Alexander Shishkin Cc: Peter Zijlstra Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/1474041004-13956-7-git-send-email-mathieu.poirier@linaro.org [ Fix the build on XSI-compliant systems, using str_error_r() to make sure we return a string, not an integer ] Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-top.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'tools/perf/builtin-top.c') diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c index 400785702566..fe3af9535e85 100644 --- a/tools/perf/builtin-top.c +++ b/tools/perf/builtin-top.c @@ -24,6 +24,7 @@ #include "util/annotate.h" #include "util/config.h" #include "util/color.h" +#include "util/drv_configs.h" #include "util/evlist.h" #include "util/evsel.h" #include "util/machine.h" @@ -913,6 +914,10 @@ static int callchain_param__setup_sample_type(struct callchain_param *callchain) static int __cmd_top(struct perf_top *top) { + char msg[512]; + struct perf_evsel *pos; + struct perf_evsel_config_term *err_term; + struct perf_evlist *evlist = top->evlist; struct record_opts *opts = &top->record_opts; pthread_t thread; int ret; @@ -947,6 +952,14 @@ static int __cmd_top(struct perf_top *top) if (ret) goto out_delete; + ret = perf_evlist__apply_drv_configs(evlist, &pos, &err_term); + if (ret) { + error("failed to set config \"%s\" on event %s with %d (%s)\n", + err_term->val.drv_cfg, perf_evsel__name(pos), errno, + str_error_r(errno, msg, sizeof(msg))); + goto out_delete; + } + top->session->evlist = top->evlist; perf_session__set_id_hdr_size(top->session); -- cgit v1.2.3-59-g8ed1b