perf python: Make twatch.py use soft dummy event, freq=0
authorArnaldo Carvalho de Melo <[email protected]>
Mon, 27 Jul 2015 20:13:21 +0000 (17:13 -0300)
committerArnaldo Carvalho de Melo <[email protected]>
Wed, 29 Jul 2015 13:51:45 +0000 (10:51 -0300)
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 <[email protected]>
Suggested-by: Peter Zijlstra <[email protected]>
Cc: Adrian Hunter <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jaroslav Skarvada <[email protected]>
Cc: Jeremy Eder <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Stephane Eranian <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
tools/perf/python/twatch.py

index 2225162ee1fc169de376f04c62b6abb6df6611ea..b9d508336ae6ff0f39de4bee8a98083503ab4dca 100755 (executable)
@@ -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)