aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/python/twatch.py
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2015-07-27 16:13:21 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-07-29 09:51:45 -0400
commit58b32c1b538f2d197ce385d6a314e83f8b787021 (patch)
tree279b5d0478e1e5e7af9f7f3127be341b81a29048 /tools/perf/python/twatch.py
parent84576da2f72e51be63c5b63c0e297028fa7ac59f (diff)
perf python: Make twatch.py use soft dummy event, freq=0
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>
Diffstat (limited to 'tools/perf/python/twatch.py')
-rwxr-xr-xtools/perf/python/twatch.py12
1 files changed, 11 insertions, 1 deletions
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
18def main(): 18def main():
19 cpus = perf.cpu_map() 19 cpus = perf.cpu_map()
20 threads = perf.thread_map() 20 threads = perf.thread_map()
21 evsel = perf.evsel(task = 1, comm = 1, mmap = 0, 21 evsel = perf.evsel(type = perf.TYPE_SOFTWARE,
22 config = perf.COUNT_SW_DUMMY,
23 task = 1, comm = 1, mmap = 0, freq = 0,
22 wakeup_events = 1, watermark = 1, 24 wakeup_events = 1, watermark = 1,
23 sample_id_all = 1, 25 sample_id_all = 1,
24 sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU) 26 sample_type = perf.SAMPLE_PERIOD | perf.SAMPLE_TID | perf.SAMPLE_CPU)
27
28 """What we want are just the PERF_RECORD_ lifetime events for threads,
29 using the default, PERF_TYPE_HARDWARE + PERF_COUNT_HW_CYCLES & freq=1
30 (the default), makes perf reenable irq_vectors:local_timer_entry, when
31 disabling nohz, not good for some use cases where all we want is to get
32 threads comes and goes... So use (perf.TYPE_SOFTWARE, perf_COUNT_SW_DUMMY,
33 freq=0) instead."""
34
25 evsel.open(cpus = cpus, threads = threads); 35 evsel.open(cpus = cpus, threads = threads);
26 evlist = perf.evlist(cpus, threads) 36 evlist = perf.evlist(cpus, threads)
27 evlist.add(evsel) 37 evlist.add(evsel)