Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3858730imj; Tue, 19 Feb 2019 10:39:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZZXSZDntFqVN85doA3xY4GLn9g5/Ebld24IGzHZK+t3oZF+CAm5+F5xF4fISM5cWQf5R97 X-Received: by 2002:aa7:8847:: with SMTP id k7mr30206910pfo.99.1550601565224; Tue, 19 Feb 2019 10:39:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550601565; cv=none; d=google.com; s=arc-20160816; b=L2GTpKXN+8QXtsgJLJRTWlnGHkPEp74iQtKW9Y5/GzpfIkyuxZm+ba2ipU40P9VqDp WDzZu3g1hjosU0stv/JF6uaX9Ez78E9MXsWZ8zjb9qYdZkjoAg5O+NGi9nqp/dH+N5r2 EmeJS2kcb1DtbeNRs9LMouW4aG4oXRSVA6Lml95TxkWBpyIMCJJyAsanWyY3+K8VHVpq r45DbI0Qi4UHbFpl+siqXW5mbpj1gfp+eik+tiwVzgjD85NmJfiB9T4Bw9x/qJus52nZ vTKNaaY0XxKATyT55einl2x3BfUWjT4eKYI97cvsEESVMnXSrOzqn11PWFGb1TC1R+5c FvVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=bHs8kQUMjVWZSB20gHUMqMj1yYJxohQnFS6WobVRz+A=; b=V6hPzussD0P4qK4pnNPd4P6RQLihHyW1Ei5/si2hSf/5+Aww9ef4Eai+c7OsM3x8ik UJ3/jjB1MRUWAyoGWEJwylgB/87UJzOQq2BU/jA9wk1zWRD/8sfJWq1ai2flY0JUQdNP oozsAli0GrZvq1ZDgvVlfw+HiY7m5bfwp0Ja2B098oj/f2AcOeNoHralyainqR6BOXnY pAqC0w1QEcO+qaA+g9a6Orb+A5OhAK6wZfQx/c8Q9SixP5HeiIFkHObTvLm4Zt742UGT 9abA3x9b4Fi+QDcOQqgOhW6m840WRX+3K5w79nKBZfPeaEy3TNcigh9vVO6CesFCvqy/ V4bg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34si14950736pld.305.2019.02.19.10.39.10; Tue, 19 Feb 2019 10:39:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728037AbfBSSij (ORCPT + 99 others); Tue, 19 Feb 2019 13:38:39 -0500 Received: from mx-rz-3.rrze.uni-erlangen.de ([131.188.11.22]:40947 "EHLO mx-rz-3.rrze.uni-erlangen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726342AbfBSSij (ORCPT ); Tue, 19 Feb 2019 13:38:39 -0500 Received: from mx-rz-smart.rrze.uni-erlangen.de (mx-rz-smart.rrze.uni-erlangen.de [IPv6:2001:638:a000:1025::1e]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx-rz-3.rrze.uni-erlangen.de (Postfix) with ESMTPS id 443qHw6Kjqz20VF; Tue, 19 Feb 2019 19:38:36 +0100 (CET) Authentication-Results: mx-rz-3.rrze.uni-erlangen.de; dkim=none reason="no signature"; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Virus-Scanned: amavisd-new at boeck4.rrze.uni-erlangen.de (RRZE) X-RRZE-Flag: Not-Spam X-RRZE-Submit-IP: 10.21.0.253 Received: from fau.de (faustud-010-021-000-253.pool.uni-erlangen.de [10.21.0.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: U2FsdGVkX1+RS4bPv27qHATeRGGC//69+XJ3CbAfkHg=) by smtp-auth.uni-erlangen.de (Postfix) with ESMTPSA id 443qHt5pkwz204J; Tue, 19 Feb 2019 19:38:34 +0100 (CET) From: Jonas Rabenstein To: linux-perf-users@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Andi Kleen , Thomas Richter , Stephane Eranian , Jonas Rabenstein , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] perf evsel: add inline functions to sample callchain output Date: Tue, 19 Feb 2019 19:38:10 +0100 Message-Id: <6aab7b5b0816426fed3cb2f2a2ba08e73e4c51e2.1550600520.git.jonas.rabenstein@studium.uni-erlangen.de> X-Mailer: git-send-email 2.19.2 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Whenever a callchain shall be printed search for each address whether inline information is available and add those symbols to the output if symbol_conf.inline_name is enabled. Signed-off-by: Jonas Rabenstein --- tools/perf/util/evsel_fprintf.c | 46 +++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tools/perf/util/evsel_fprintf.c b/tools/perf/util/evsel_fprintf.c index c710f687ddf4..9f9ece453dc4 100644 --- a/tools/perf/util/evsel_fprintf.c +++ b/tools/perf/util/evsel_fprintf.c @@ -168,6 +168,49 @@ static int __fprintf_callchain_link(u64 ip, struct map *map, struct symbol *symb return printed; } +static int __fprintf_callchain_inlines(struct callchain_cursor_node *node, + bool first, int left_alignment, + unsigned int print_opts, FILE *fp) +{ + int printed = 0; + struct inline_node *inline_node; + struct inline_list *ilist; + u64 addr; + + if (!symbol_conf.inline_name) + return 0; + + if (!node->map || !node->map->dso) + return 0; + + addr = node->map->map_ip(node->map, node->ip); + + inline_node = inlines__tree_find(&node->map->dso->inlined_nodes, + addr); + if (!inline_node) { + inline_node = dso__parse_addr_inlines(node->map->dso, + addr, node->sym); + if (!inline_node) + return 0; + inlines__tree_insert(&node->map->dso->inlined_nodes, + inline_node); + } + + list_for_each_entry(ilist, &inline_node->val, list) { + if (ilist->symbol == node->sym) + break; + + printed += __fprintf_callchain_link(node->ip, node->map, + ilist->symbol, + ilist->srcline, + first, left_alignment, + print_opts, fp); + first = (first && printed == 0); + } + + return printed; +} + int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, unsigned int print_opts, struct callchain_cursor *cursor, FILE *fp) @@ -183,6 +226,9 @@ int sample__fprintf_callchain(struct perf_sample *sample, int left_alignment, if (!node) break; + printed += __fprintf_callchain_inlines(node, (printed == 0), + left_alignment, + print_opts, fp); printed += __fprintf_callchain_link(node->ip, node->map, node->sym, NULL, -- 2.19.2