Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1788244imm; Mon, 3 Sep 2018 09:25:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbHkZSIqJ9rVBnDNo08uZsF2kcYzZrvEdmhFSgz+y6HAuT/ttEKwNZkOTWJnQspg/mWVIWo X-Received: by 2002:a63:986:: with SMTP id 128-v6mr6630215pgj.153.1535991920757; Mon, 03 Sep 2018 09:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535991920; cv=none; d=google.com; s=arc-20160816; b=Mr+dflrLYEKvYeEEoPKlTnQoBCFX6TNqYtufwGzcWk+ekuE5RN1OU+UGCAPc9h7p2t ZMbmb/l6k+wklOV9s8mS/l25n8QlajoWcu7RC40KdJPUjDh4h00V+q28Bsvp4LmrSc8m +lOWoEfDfCT8EbSxbqmA4ZTkXaAg61K5+won4gc+J2EXwdyKY785t2MrAswja+R+4XOX rkZLzLFqkWZGg6m9t6eiq6KuHxM+ysHvbnx8kN+cvZePdeua47h7XnEutkdXUlZh31lX Tl3gj165d7o//NXgwPwcQCKi6wBAUCgUcG20Z4vKuspOUczFPCkGQxYrIOxWM1dmdyCi Tt8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=cIroFa9eDVmJq21qQlxMTNu8n6aM6NM4a4hG3S2ssF4=; b=uhHrB3BGHBGeScW7ZPKauGZnwq1/hg+JyXeB4LK/Cg1rcki/0zXytABVEI4Hw00jn1 evpwSeSbO84E9T3+/Youdb6EY3DMwguiotuk86SyXYBcbyPK/V48ydu22fMH5YXEI+bp 66BLeA86Tv3CxWoBBciFEKVGzYH7NjkjufMbzviT+DwC4D5APuAROZIk6MiM0SExsoRg YHzgHHy6lZQszV40gYdKSjxNiJmB7w5PQOURwXZeVkShPnmCMpWCE8MR8vaprMVZHAph RyWKgxNJbY/mO16a04BbCACYBnp1WkE3tYCyktJ1PxZzN9XA5l1n9orMFTM/UXC7y9VT 5lpg== 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 k38-v6si14774682pgm.335.2018.09.03.09.24.49; Mon, 03 Sep 2018 09:25:20 -0700 (PDT) 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 S1727748AbeICUoV (ORCPT + 99 others); Mon, 3 Sep 2018 16:44:21 -0400 Received: from mga05.intel.com ([192.55.52.43]:60106 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727513AbeICUoU (ORCPT ); Mon, 3 Sep 2018 16:44:20 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Sep 2018 09:22:55 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,325,1531810800"; d="scan'208";a="70244076" Received: from tassilo.jf.intel.com (HELO tassilo.localdomain) ([10.7.201.126]) by orsmga008.jf.intel.com with ESMTP; 03 Sep 2018 09:22:55 -0700 Received: by tassilo.localdomain (Postfix, from userid 1000) id 63B74301B65; Mon, 3 Sep 2018 09:22:55 -0700 (PDT) From: Andi Kleen To: acme@kernel.org Cc: jolsa@kernel.org, adrian.hunter@intel.com, kim.phillips@arm.com, linux-kernel@vger.kernel.org, Andi Kleen Subject: [PATCH v4 5/8] perf, tools, script: Print DSO for callindent Date: Mon, 3 Sep 2018 09:22:46 -0700 Message-Id: <20180903162249.36304-6-andi@firstfloor.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180903162249.36304-1-andi@firstfloor.org> References: <20180903162249.36304-1-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andi Kleen Now that we don't need to print the IP/ADDR for callindent the DSO is also not printed. It's useful for some cases, so add an own DSO printout for callindent for the case when IP/ADDR is not enabled. Before: % perf script --itrace=cr -F +callindent,-ip,-sym,-symoff,-addr swapper 0 [000] 3377.917072: 1 branches: pt_config swapper 0 [000] 3377.917072: 1 branches: pt_config swapper 0 [000] 3377.917072: 1 branches: pt_event_add swapper 0 [000] 3377.917072: 1 branches: perf_pmu_enable swapper 0 [000] 3377.917072: 1 branches: perf_pmu_nop_void swapper 0 [000] 3377.917072: 1 branches: event_sched_in.isra.107 swapper 0 [000] 3377.917072: 1 branches: __x86_indirect_thunk_rax swapper 0 [000] 3377.917072: 1 branches: perf_pmu_nop_int swapper 0 [000] 3377.917072: 1 branches: group_sched_in swapper 0 [000] 3377.917072: 1 branches: event_filter_match swapper 0 [000] 3377.917072: 1 branches: event_filter_match swapper 0 [000] 3377.917072: 1 branches: group_sched_in After: swapper 0 [000] 3377.917072: 1 branches: ([unknown]) pt_config swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) pt_config swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) pt_event_add swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) perf_pmu_enable swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) perf_pmu_nop_void swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) event_sched_in.isra.107 swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) __x86_indirect_thunk_rax swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) perf_pmu_nop_int swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) group_sched_in swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) event_filter_match swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) event_filter_match swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) group_sched_in swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) __x86_indirect_thunk_rax swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) perf_pmu_nop_txn swapper 0 [000] 3377.917072: 1 branches: ([kernel.kallsyms]) event_sched_in.isra.107 (in the kernel case of course it's not very useful, but it's important with user programs where symbols are not unique) Signed-off-by: Andi Kleen --- tools/perf/builtin-script.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index d7d454d10074..812269ee9d33 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -1116,6 +1116,7 @@ static int perf_sample__fprintf_callindent(struct perf_sample *sample, const char *name = NULL; static int spacing; int len = 0; + int dlen = 0; u64 ip = 0; /* @@ -1142,6 +1143,12 @@ static int perf_sample__fprintf_callindent(struct perf_sample *sample, ip = sample->ip; } + if (PRINT_FIELD(DSO) && !(PRINT_FIELD(IP) || PRINT_FIELD(ADDR))) { + dlen += fprintf(fp, "("); + dlen += map__fprintf_dsoname(al->map, fp); + dlen += fprintf(fp, ")\t"); + } + if (name) len = fprintf(fp, "%*s%s", (int)depth * 4, "", name); else if (ip) @@ -1160,7 +1167,7 @@ static int perf_sample__fprintf_callindent(struct perf_sample *sample, if (len < spacing) len += fprintf(fp, "%*s", spacing - len, ""); - return len; + return len + dlen; } static int perf_sample__fprintf_insn(struct perf_sample *sample, -- 2.17.1