From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932766AbcKYRUL (ORCPT ); Fri, 25 Nov 2016 12:20:11 -0500 Received: from terminus.zytor.com ([198.137.202.10]:49830 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932602AbcKYRTx (ORCPT ); Fri, 25 Nov 2016 12:19:53 -0500 Date: Fri, 25 Nov 2016 09:19:38 -0800 From: tip-bot for Namhyung Kim Message-ID: Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com, andi@firstfloor.org, jolsa@kernel.org, eranian@google.com, a.p.zijlstra@chello.nl, namhyung@kernel.org, mingo@kernel.org Reply-To: linux-kernel@vger.kernel.org, tglx@linutronix.de, dsahern@gmail.com, hpa@zytor.com, acme@redhat.com, andi@firstfloor.org, eranian@google.com, jolsa@kernel.org, mingo@kernel.org, namhyung@kernel.org, a.p.zijlstra@chello.nl In-Reply-To: <20161124011114.7102-1-namhyung@kernel.org> References: <20161124011114.7102-1-namhyung@kernel.org> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf sched timehist: Mark schedule function in callchains Git-Commit-ID: cdeb01bf7863718bbbbdac2a2c3a12b62366757a X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: cdeb01bf7863718bbbbdac2a2c3a12b62366757a Gitweb: http://git.kernel.org/tip/cdeb01bf7863718bbbbdac2a2c3a12b62366757a Author: Namhyung Kim AuthorDate: Thu, 24 Nov 2016 10:11:12 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Fri, 25 Nov 2016 10:49:43 -0300 perf sched timehist: Mark schedule function in callchains The sched_switch event always captured from the scheduler function. So it'd be great omit them from the callchain. This patch marks the functions to be omitted by later patch. Committer notes: Testing it: Before: [root@jouet experimental]# perf sched record -g ls Dockerfile perf.data x-mips64 [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 1.355 MB perf.data (29 samples) ] [root@jouet experimental]# perf sched timehist time cpu task name wait time sch delay run time [tid/pid] (msec) (msec) (msec) ----------- ----- ----------------- ------ ------ ------ 6.494998 [001] 0.000 0.000 0.000 6.495027 [002] perf[519] 0.000 0.000 0.000 __schedule <- schedule <- schedule_hrtimeout_range_clock <- schedule_hrtimeou 6.495096 [003] 0.000 0.000 0.000 6.495100 [003] rcuos/0[9] 0.000 0.005 0.003 __schedule <- schedule <- rcu_nocb_kthread <- kthread <- ret_from_fork 6.495113 [001] perf[520] 0.000 0.008 0.114 __schedule <- preempt_schedule_common <- _cond_resched <- wait_for_completion 6.495121 [000] 0.000 0.000 0.000 6.495129 [001] migration/1[17] 0.000 0.003 0.016 __schedule <- schedule <- smpboot_thread_fn <- kthread <- ret_from_fork 6.496085 [002] 0.000 0.000 1.057 6.496096 [002] kworker/u16:1[31169] 0.000 0.004 0.011 __schedule <- schedule <- worker_thread <- kthread <- ret_from_fork 6.496096 [003] 0.003 0.000 0.996 6.496169 [002] 0.011 0.000 0.072 6.496171 [000] ls[520] 0.008 0.000 1.049 __schedule <- schedule <- do_exit <- do_group_exit <- [unknown] 6.496172 [003] gnome-terminal-[4391] 0.000 0.003 0.076 __schedule <- schedule <- schedule_hrtimeout_range_clock <- schedule_hrtimeo After: [root@jouet experimental]# perf sched timehist time cpu task name wait time sch delay run time [tid/pid] (msec) (msec) (msec) ----------- ----- ----------------- ----- ----- ------ 6.494998 [001] 0.000 0.000 0.000 6.495027 [002] perf[519] 0.000 0.000 0.000 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_t 6.495096 [003] 0.000 0.000 0.000 6.495100 [003] rcuos/0[9] 0.000 0.005 0.003 rcu_nocb_kthread <- kthread <- ret_from_fork 6.495113 [001] perf[520] 0.000 0.008 0.114 preempt_schedule_common <- _cond_resched <- wait_for_completion <- stop_one_c 6.495121 [000] 0.000 0.000 0.000 6.495129 [001] migration/1[17] 0.000 0.003 0.016 smpboot_thread_fn <- kthread <- ret_from_fork 6.496085 [002] 0.000 0.000 1.057 6.496096 [002] kworker/u16:1[31169] 0.000 0.004 0.011 worker_thread <- kthread <- ret_from_fork 6.496096 [003] 0.003 0.000 0.996 6.496169 [002] 0.011 0.000 0.072 6.496171 [000] ls[520] 0.008 0.000 1.049 do_exit <- do_group_exit <- [unknown] 6.496172 [003] gnome-terminal-[4391] 0.000 0.003 0.076 schedule_hrtimeout_range_clock <- schedule_hrtimeout_range <- poll_schedule_ [root@jouet experimental]# Signed-off-by: Namhyung Kim Tested-by: Arnaldo Carvalho de Melo Cc: Andi Kleen Cc: David Ahern Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/20161124011114.7102-1-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-sched.c | 21 +++++++++++++++++++++ tools/perf/util/symbol.h | 1 + 2 files changed, 22 insertions(+) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 43fcc13..06be809 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -1966,7 +1966,28 @@ static bool is_idle_sample(struct perf_sched *sched, return false; } + callchain_cursor_commit(cursor); + + while (true) { + struct callchain_cursor_node *node; + struct symbol *sym; + + node = callchain_cursor_current(cursor); + if (node == NULL) + break; + + sym = node->sym; + if (sym && sym->name) { + if (!strcmp(sym->name, "schedule") || + !strcmp(sym->name, "__schedule") || + !strcmp(sym->name, "preempt_schedule")) + sym->ignore = 1; + } + + callchain_cursor_advance(cursor); + } + return false; } diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h index dec7e2d4..1bcbefc 100644 --- a/tools/perf/util/symbol.h +++ b/tools/perf/util/symbol.h @@ -58,6 +58,7 @@ struct symbol { u16 namelen; u8 binding; u8 idle:1; + u8 ignore:1; u8 arch_sym; char name[0]; };