From: tip-bot for Mathieu Poirier <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: hpa@zytor.com, jolsa@kernel.org, mathieu.poirier@linaro.org,
peterz@infradead.org, mingo@kernel.org,
linux-kernel@vger.kernel.org, acme@redhat.com,
alexander.shishkin@linux.intel.com, tglx@linutronix.de
Subject: [tip:perf/core] perf tools: Add PMU configuration to tools
Date: Thu, 22 Sep 2016 22:27:44 -0700 [thread overview]
Message-ID: <tip-5d8bb1ec7477e0e53dbd891733682a6583d4398e@git.kernel.org> (raw)
In-Reply-To: <1474041004-13956-7-git-send-email-mathieu.poirier@linaro.org>
Commit-ID: 5d8bb1ec7477e0e53dbd891733682a6583d4398e
Gitweb: http://git.kernel.org/tip/5d8bb1ec7477e0e53dbd891733682a6583d4398e
Author: Mathieu Poirier <mathieu.poirier@linaro.org>
AuthorDate: Fri, 16 Sep 2016 09:50:03 -0600
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 22 Sep 2016 13:07:36 -0300
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 <mathieu.poirier@linaro.org>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>
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 <acme@redhat.com>
---
tools/perf/builtin-record.c | 10 ++++++++++
tools/perf/builtin-stat.c | 9 +++++++++
tools/perf/builtin-top.c | 13 +++++++++++++
3 files changed, 32 insertions(+)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 03251c7..2d0d69b 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -22,6 +22,7 @@
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/debug.h"
+#include "util/drv_configs.h"
#include "util/session.h"
#include "util/tool.h"
#include "util/symbol.h"
@@ -383,6 +384,7 @@ static int record__open(struct record *rec)
struct perf_evlist *evlist = rec->evlist;
struct perf_session *session = rec->session;
struct record_opts *opts = &rec->opts;
+ struct perf_evsel_config_term *err_term;
int rc = 0;
perf_evlist__config(evlist, opts, &callchain_param);
@@ -412,6 +414,14 @@ try_again:
goto out;
}
+ if (perf_evlist__apply_drv_configs(evlist, &pos, &err_term)) {
+ 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)));
+ rc = -1;
+ goto out;
+ }
+
rc = record__mmap(rec);
if (rc)
goto out;
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 90882b1..688dea7 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -52,6 +52,7 @@
#include "util/evlist.h"
#include "util/evsel.h"
#include "util/debug.h"
+#include "util/drv_configs.h"
#include "util/color.h"
#include "util/stat.h"
#include "util/header.h"
@@ -540,6 +541,7 @@ static int __run_perf_stat(int argc, const char **argv)
int status = 0;
const bool forks = (argc > 0);
bool is_pipe = STAT_RECORD ? perf_stat.file.is_pipe : false;
+ struct perf_evsel_config_term *err_term;
if (interval) {
ts.tv_sec = interval / USEC_PER_MSEC;
@@ -611,6 +613,13 @@ try_again:
return -1;
}
+ if (perf_evlist__apply_drv_configs(evsel_list, &counter, &err_term)) {
+ error("failed to set config \"%s\" on event %s with %d (%s)\n",
+ err_term->val.drv_cfg, perf_evsel__name(counter), errno,
+ str_error_r(errno, msg, sizeof(msg)));
+ return -1;
+ }
+
if (STAT_RECORD) {
int err, fd = perf_data_file__fd(&perf_stat.file);
diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 4007857..fe3af95 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);
next prev parent reply other threads:[~2016-09-23 5:28 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-16 15:49 [PATCH V8 0/7] perf: Driver specific configuration for PMU Mathieu Poirier
2016-09-16 15:49 ` Mathieu Poirier
2016-09-16 15:49 ` [PATCH V8 1/7] perf tools: confining __get_cpuid() to x86 architecture Mathieu Poirier
2016-09-16 15:49 ` Mathieu Poirier
2016-09-23 5:25 ` [tip:perf/core] perf tools: Confine " tip-bot for Mathieu Poirier
2016-09-16 15:49 ` [PATCH V8 2/7] perf tools: making coresight PMU listable Mathieu Poirier
2016-09-16 15:49 ` Mathieu Poirier
2016-09-23 5:26 ` [tip:perf/core] perf tools: Make " tip-bot for Mathieu Poirier
2016-09-16 15:50 ` [PATCH V8 3/7] perf tools: adding coresight etm PMU record capabilities Mathieu Poirier
2016-09-16 15:50 ` Mathieu Poirier
2016-09-23 5:26 ` [tip:perf/core] perf tools: Add " tip-bot for Mathieu Poirier
2016-09-16 15:50 ` [PATCH V8 4/7] perf tools: add infrastructure for PMU specific configuration Mathieu Poirier
2016-09-16 15:50 ` Mathieu Poirier
2016-09-16 15:50 ` [PATCH V8 5/7] perf tools: pushing configuration down to PMU driver Mathieu Poirier
2016-09-16 15:50 ` Mathieu Poirier
2016-09-23 5:27 ` [tip:perf/core] perf pmu: Push " tip-bot for Mathieu Poirier
2016-09-16 15:50 ` [PATCH V8 6/7] perf tools: adding PMU configuration to tools Mathieu Poirier
2016-09-16 15:50 ` Mathieu Poirier
2016-09-23 5:27 ` tip-bot for Mathieu Poirier [this message]
2016-09-16 15:50 ` [PATCH V8 7/7] perf tools: adding sink configuration for cs_etm PMU Mathieu Poirier
2016-09-16 15:50 ` Mathieu Poirier
2016-09-23 5:28 ` [tip:perf/core] perf tools: Add " tip-bot for Mathieu Poirier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tip-5d8bb1ec7477e0e53dbd891733682a6583d4398e@git.kernel.org \
--to=tipbot@zytor.com \
--cc=acme@redhat.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.