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,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Borislav Petkov <bp@suse.de>, David Ahern <dsahern@gmail.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Jaroslav Skarvada <jskarvad@redhat.com>,
	Jeremy Eder <jeder@redhat.com>, Jiri Olsa <jolsa@redhat.com>,
	Namhyung Kim <namhyung@kernel.org>,
	Stephane Eranian <eranian@google.com>
Subject: [PATCH 04/10] perf python: Make twatch.py use soft dummy event, freq=0
Date: Thu, 30 Jul 2015 13:17:02 -0300	[thread overview]
Message-ID: <1438273028-5191-5-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1438273028-5191-1-git-send-email-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

To not sample, what we want are just the PERF_RECORD_ lifetime events
for threads, using the default, PERF_TYPE_HARDWARE +
PERF_COUNT_HW_CYCLES and freq=1 (the default), makes perf reenable
irq_vectors:local_timer_entry, disabling nohz, not good for some use
cases where all we want is to get notifications when threads comes and
goes...

Fix it by using PERF_TYPE_SOFTWARE (no counter rotation) and
PERF_COUNT_SW_DUMMY (created by Adrian so that we could have access to
those PERF_RECORD_ goodies).

Reported-by: Luiz Fernando Capitulino <lcapitulino@redhat.com>
Suggested-by: Peter Zijlstra <peterz@infradead.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jaroslav Skarvada <jskarvad@redhat.com>
Cc: Jeremy Eder <jeder@redhat.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-kfsijirfrs6xfhkcdxeoen06@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/python/twatch.py | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/perf/python/twatch.py b/tools/perf/python/twatch.py
index 2225162ee1fc..b9d508336ae6 100755
--- a/tools/perf/python/twatch.py
+++ b/tools/perf/python/twatch.py
@@ -18,10 +18,20 @@ import perf
 def main():
 	cpus = perf.cpu_map()
 	threads = perf.thread_map()
-	evsel = perf.evsel(task = 1, comm = 1, mmap = 0,
+	evsel = perf.evsel(type	  = perf.TYPE_SOFTWARE,
+			   config = perf.COUNT_SW_DUMMY,
+			   task = 1, comm = 1, mmap = 0, freq = 0,
 			   wakeup_events = 1, watermark = 1,
 			   sample_id_all = 1,
 			   sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU)
+
+	"""What we want are just the PERF_RECORD_ lifetime events for threads,
+	 using the default, PERF_TYPE_HARDWARE + PERF_COUNT_HW_CYCLES & freq=1
+	 (the default), makes perf reenable irq_vectors:local_timer_entry, when
+	 disabling nohz, not good for some use cases where all we want is to get
+	 threads comes and goes... So use (perf.TYPE_SOFTWARE, perf_COUNT_SW_DUMMY,
+	 freq=0) instead."""
+
 	evsel.open(cpus = cpus, threads = threads);
 	evlist = perf.evlist(cpus, threads)
 	evlist.add(evsel)
-- 
2.1.0


  parent reply	other threads:[~2015-07-30 16:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-30 16:16 [GIT PULL 00/10] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-07-30 16:16 ` [PATCH 01/10] perf python: Remove dependency on 'machine' methods Arnaldo Carvalho de Melo
2015-07-30 16:17 ` [PATCH 02/10] perf python: Add macro to simplify maintainance of the constants array Arnaldo Carvalho de Melo
2015-07-30 16:17 ` [PATCH 03/10] perf python: Add missing PERF_RECORD_{MMAP2,AUX,etc} Arnaldo Carvalho de Melo
2015-07-30 16:17 ` Arnaldo Carvalho de Melo [this message]
2015-07-30 16:17 ` [PATCH 05/10] perf symbols: Fix mismatched declarations for elf_getphdrnum Arnaldo Carvalho de Melo
2015-07-30 16:17 ` [PATCH 06/10] perf session env: Rename exit method Arnaldo Carvalho de Melo
2015-07-30 16:17 ` [PATCH 07/10] perf tools: Add support for event post configuration Arnaldo Carvalho de Melo
2015-07-30 16:17 ` [PATCH 08/10] perf tools: Force period term to overload global settings Arnaldo Carvalho de Melo
2015-07-30 16:17 ` [PATCH 09/10] perf tools: Introduce callgraph_set for callgraph option Arnaldo Carvalho de Melo
2015-07-30 16:17 ` [PATCH 10/10] perf tests: Adding build test for having ending double slash Arnaldo Carvalho de Melo
2015-07-31  8:04 ` [GIT PULL 00/10] perf/core improvements and fixes Ingo Molnar
2015-07-31 13:30   ` Arnaldo Carvalho de Melo

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=1438273028-5191-5-git-send-email-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=bp@suse.de \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jeder@redhat.com \
    --cc=jolsa@redhat.com \
    --cc=jskarvad@redhat.com \
    --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).