linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org, Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	David Ahern <dsahern@gmail.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 09/14] perf evsel: Introduce disable() method
Date: Mon,  7 Dec 2015 19:17:14 -0300	[thread overview]
Message-ID: <1449526639-3667-10-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1449526639-3667-1-git-send-email-acme@kernel.org>

From: Jiri Olsa <jolsa@kernel.org>

Adding perf_evsel__disable function to have complement for
perf_evsel__enable function. Both will be used in following patch to
factor perf_evlist__(enable|disable).

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1449133606-14429-3-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evsel.c | 10 ++++++++++
 tools/perf/util/evsel.h |  1 +
 2 files changed, 11 insertions(+)

diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c
index 3a9b5068667d..47f033089349 100644
--- a/tools/perf/util/evsel.c
+++ b/tools/perf/util/evsel.c
@@ -991,6 +991,16 @@ int perf_evsel__enable(struct perf_evsel *evsel)
 				     0);
 }
 
+int perf_evsel__disable(struct perf_evsel *evsel)
+{
+	int nthreads = thread_map__nr(evsel->threads);
+	int ncpus = cpu_map__nr(evsel->cpus);
+
+	return perf_evsel__run_ioctl(evsel, ncpus, nthreads,
+				     PERF_EVENT_IOC_DISABLE,
+				     0);
+}
+
 int perf_evsel__alloc_id(struct perf_evsel *evsel, int ncpus, int nthreads)
 {
 	if (ncpus == 0 || nthreads == 0)
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h
index a721592a3200..5ded1fc0341e 100644
--- a/tools/perf/util/evsel.h
+++ b/tools/perf/util/evsel.h
@@ -228,6 +228,7 @@ int perf_evsel__append_filter(struct perf_evsel *evsel,
 int perf_evsel__apply_filter(struct perf_evsel *evsel, int ncpus, int nthreads,
 			     const char *filter);
 int perf_evsel__enable(struct perf_evsel *evsel);
+int perf_evsel__disable(struct perf_evsel *evsel);
 
 int perf_evsel__open_per_cpu(struct perf_evsel *evsel,
 			     struct cpu_map *cpus);
-- 
2.1.0


  parent reply	other threads:[~2015-12-07 22:21 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 22:17 [GIT PULL 00/14] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 01/14] perf machine: Pass correct string to dso__adjust_kmod_long_name Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 02/14] perf test: Use machine__new_host in dwarf unwind test Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 03/14] perf test: Use machine__new_host in mmap thread lookup test Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 04/14] perf test: Use machine__new_host in mmap thread code reading test Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 05/14] perf test: Fix cpus and thread maps reference in error path Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 06/14] perf test: Prevent using bpf-output event in round trip name test Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 07/14] perf test: Create kernel maps properly for hist entries test Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 08/14] perf evsel: Use event maps directly in perf_evsel__enable Arnaldo Carvalho de Melo
2015-12-07 22:17 ` Arnaldo Carvalho de Melo [this message]
2015-12-07 22:17 ` [PATCH 10/14] perf evlist: Factor perf_evlist__(enable|disable) functions Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 11/14] perf stat: Use perf_evlist__enable in handle_initial_delay Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 12/14] perf stat: Create events as disabled Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 13/14] perf stat: Move enable_on_exec setup under earlier code Arnaldo Carvalho de Melo
2015-12-07 22:17 ` [PATCH 14/14] perf annotate: ARM support Arnaldo Carvalho de Melo
2015-12-08  4:24 ` [GIT PULL 00/14] perf/core improvements and fixes Ingo Molnar

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=1449526639-3667-10-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=dsahern@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).