summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-sched.c
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2016-12-08 09:47:53 -0500
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-12-15 14:25:44 -0500
commita4b2b6f56e0cfe729cf89318d44b6a875b31d95a (patch)
tree1c7a76628da82dfa1bef191fc882daa3490137ff /tools/perf/builtin-sched.c
parent699b5b920db04a6ff5c03a519e4c182aeb350952 (diff)
perf sched timehist: Skip non-idle events when necessary
Sometimes it only focuses on idle-related events like upcoming idle-hist feature. In this case we don't want to see other event to reduce noise. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: David Ahern <dsahern@gmail.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Minchan Kim <minchan@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/20161208144755.16673-5-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-sched.c')
-rw-r--r--tools/perf/builtin-sched.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index dc83b803ca54..c8e7848e71a7 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -2190,7 +2190,9 @@ static struct thread *timehist_get_thread(struct perf_sched *sched,
2190} 2190}
2191 2191
2192static bool timehist_skip_sample(struct perf_sched *sched, 2192static bool timehist_skip_sample(struct perf_sched *sched,
2193 struct thread *thread) 2193 struct thread *thread,
2194 struct perf_evsel *evsel,
2195 struct perf_sample *sample)
2194{ 2196{
2195 bool rc = false; 2197 bool rc = false;
2196 2198
@@ -2199,10 +2201,19 @@ static bool timehist_skip_sample(struct perf_sched *sched,
2199 sched->skipped_samples++; 2201 sched->skipped_samples++;
2200 } 2202 }
2201 2203
2204 if (sched->idle_hist) {
2205 if (strcmp(perf_evsel__name(evsel), "sched:sched_switch"))
2206 rc = true;
2207 else if (perf_evsel__intval(evsel, sample, "prev_pid") != 0 &&
2208 perf_evsel__intval(evsel, sample, "next_pid") != 0)
2209 rc = true;
2210 }
2211
2202 return rc; 2212 return rc;
2203} 2213}
2204 2214
2205static void timehist_print_wakeup_event(struct perf_sched *sched, 2215static void timehist_print_wakeup_event(struct perf_sched *sched,
2216 struct perf_evsel *evsel,
2206 struct perf_sample *sample, 2217 struct perf_sample *sample,
2207 struct machine *machine, 2218 struct machine *machine,
2208 struct thread *awakened) 2219 struct thread *awakened)
@@ -2215,8 +2226,8 @@ static void timehist_print_wakeup_event(struct perf_sched *sched,
2215 return; 2226 return;
2216 2227
2217 /* show wakeup unless both awakee and awaker are filtered */ 2228 /* show wakeup unless both awakee and awaker are filtered */
2218 if (timehist_skip_sample(sched, thread) && 2229 if (timehist_skip_sample(sched, thread, evsel, sample) &&
2219 timehist_skip_sample(sched, awakened)) { 2230 timehist_skip_sample(sched, awakened, evsel, sample)) {
2220 return; 2231 return;
2221 } 2232 }
2222 2233
@@ -2261,7 +2272,7 @@ static int timehist_sched_wakeup_event(struct perf_tool *tool,
2261 /* show wakeups if requested */ 2272 /* show wakeups if requested */
2262 if (sched->show_wakeups && 2273 if (sched->show_wakeups &&
2263 !perf_time__skip_sample(&sched->ptime, sample->time)) 2274 !perf_time__skip_sample(&sched->ptime, sample->time))
2264 timehist_print_wakeup_event(sched, sample, machine, thread); 2275 timehist_print_wakeup_event(sched, evsel, sample, machine, thread);
2265 2276
2266 return 0; 2277 return 0;
2267} 2278}
@@ -2288,8 +2299,8 @@ static void timehist_print_migration_event(struct perf_sched *sched,
2288 if (thread == NULL) 2299 if (thread == NULL)
2289 return; 2300 return;
2290 2301
2291 if (timehist_skip_sample(sched, thread) && 2302 if (timehist_skip_sample(sched, thread, evsel, sample) &&
2292 timehist_skip_sample(sched, migrated)) { 2303 timehist_skip_sample(sched, migrated, evsel, sample)) {
2293 return; 2304 return;
2294 } 2305 }
2295 2306
@@ -2374,7 +2385,7 @@ static int timehist_sched_change_event(struct perf_tool *tool,
2374 goto out; 2385 goto out;
2375 } 2386 }
2376 2387
2377 if (timehist_skip_sample(sched, thread)) 2388 if (timehist_skip_sample(sched, thread, evsel, sample))
2378 goto out; 2389 goto out;
2379 2390
2380 tr = thread__get_runtime(thread); 2391 tr = thread__get_runtime(thread);