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, Namhyung Kim <namhyung@kernel.org>,
	Andi Kleen <andi@firstfloor.org>, Jiri Olsa <jolsa@kernel.org>,
	Minchan Kim <minchan@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 05/22] perf sched timehist: Skip non-idle events when necessary
Date: Tue, 13 Dec 2016 12:09:11 -0300	[thread overview]
Message-ID: <20161213150928.13144-6-acme@kernel.org> (raw)
In-Reply-To: <20161213150928.13144-1-acme@kernel.org>

From: Namhyung Kim <namhyung@kernel.org>

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>
---
 tools/perf/builtin-sched.c | 25 ++++++++++++++++++-------
 1 file 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,
 }
 
 static bool timehist_skip_sample(struct perf_sched *sched,
-				 struct thread *thread)
+				 struct thread *thread,
+				 struct perf_evsel *evsel,
+				 struct perf_sample *sample)
 {
 	bool rc = false;
 
@@ -2199,10 +2201,19 @@ static bool timehist_skip_sample(struct perf_sched *sched,
 		sched->skipped_samples++;
 	}
 
+	if (sched->idle_hist) {
+		if (strcmp(perf_evsel__name(evsel), "sched:sched_switch"))
+			rc = true;
+		else if (perf_evsel__intval(evsel, sample, "prev_pid") != 0 &&
+			 perf_evsel__intval(evsel, sample, "next_pid") != 0)
+			rc = true;
+	}
+
 	return rc;
 }
 
 static void timehist_print_wakeup_event(struct perf_sched *sched,
+					struct perf_evsel *evsel,
 					struct perf_sample *sample,
 					struct machine *machine,
 					struct thread *awakened)
@@ -2215,8 +2226,8 @@ static void timehist_print_wakeup_event(struct perf_sched *sched,
 		return;
 
 	/* show wakeup unless both awakee and awaker are filtered */
-	if (timehist_skip_sample(sched, thread) &&
-	    timehist_skip_sample(sched, awakened)) {
+	if (timehist_skip_sample(sched, thread, evsel, sample) &&
+	    timehist_skip_sample(sched, awakened, evsel, sample)) {
 		return;
 	}
 
@@ -2261,7 +2272,7 @@ static int timehist_sched_wakeup_event(struct perf_tool *tool,
 	/* show wakeups if requested */
 	if (sched->show_wakeups &&
 	    !perf_time__skip_sample(&sched->ptime, sample->time))
-		timehist_print_wakeup_event(sched, sample, machine, thread);
+		timehist_print_wakeup_event(sched, evsel, sample, machine, thread);
 
 	return 0;
 }
@@ -2288,8 +2299,8 @@ static void timehist_print_migration_event(struct perf_sched *sched,
 	if (thread == NULL)
 		return;
 
-	if (timehist_skip_sample(sched, thread) &&
-	    timehist_skip_sample(sched, migrated)) {
+	if (timehist_skip_sample(sched, thread, evsel, sample) &&
+	    timehist_skip_sample(sched, migrated, evsel, sample)) {
 		return;
 	}
 
@@ -2374,7 +2385,7 @@ static int timehist_sched_change_event(struct perf_tool *tool,
 		goto out;
 	}
 
-	if (timehist_skip_sample(sched, thread))
+	if (timehist_skip_sample(sched, thread, evsel, sample))
 		goto out;
 
 	tr = thread__get_runtime(thread);
-- 
2.9.3

  parent reply	other threads:[~2016-12-13 15:10 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-13 15:09 [GIT PULL 00/22] perf/core improvements and fixes Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 01/22] perf tools: Move headers check into bash script Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 02/22] perf sched timehist: Split is_idle_sample() Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 03/22] perf sched timehist: Introduce struct idle_time_data Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 04/22] perf sched timehist: Save callchain when entering idle Arnaldo Carvalho de Melo
2016-12-13 15:09 ` Arnaldo Carvalho de Melo [this message]
2016-12-13 15:09 ` [PATCH 06/22] perf sched timehist: Add -I/--idle-hist option Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 07/22] perf sched timehist: Show callchains for idle stat Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 08/22] tools lib bpf: Sync {tools,}/include/uapi/linux/bpf.h Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 09/22] tools lib bpf: use __u32 from linux/types.h Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 10/22] tools lib bpf: Add flags to bpf_create_map() Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 11/22] samples/bpf: Make samples more libbpf-centric Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 12/22] samples/bpf: Switch over to libbpf Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 13/22] samples/bpf: Remove perf_event_open() declaration Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 14/22] samples/bpf: Move open_raw_sock to separate header Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 15/22] perf sdt: Add scanning of sdt probles arguments Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 16/22] perf tools: Remove some needless __maybe_unused Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 17/22] perf mem: Fix --all-user/--all-kernel options Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 18/22] perf evsel: Use variable instead of repeating lengthy FD macro Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 19/22] perf thread_map: Add thread_map__remove function Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 20/22] perf evsel: Allow to ignore missing pid Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 21/22] perf record: Force ignore_missing_thread for uid option Arnaldo Carvalho de Melo
2016-12-13 15:09 ` [PATCH 22/22] samples/bpf: Drop unnecessary build targets 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=20161213150928.13144-6-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=andi@firstfloor.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=minchan@kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.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).