Received: by 10.223.176.5 with SMTP id f5csp444699wra; Fri, 9 Feb 2018 01:31:26 -0800 (PST) X-Google-Smtp-Source: AH8x227DcN2Q3L5wOkQ8fzRsLNnjRkkEG2/IK3YDSvWSBJi7Yzf3Poe1+kVb6gBMb0kUtxdWpmTV X-Received: by 10.98.133.20 with SMTP id u20mr2159913pfd.156.1518168686409; Fri, 09 Feb 2018 01:31:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518168686; cv=none; d=google.com; s=arc-20160816; b=NtXWKLqnTqQNJOoORHR4CeEjFg4k8+Rs0L0vVLAJf2a+b54/YGOejibMacB808gpCY 1UFdRCSRC0IshAAPwwHNq3OptvFDVRnPLEwbSrJIee3bkYAF3bVmVU5C2BGjZ1ePf9uz UoZiAFkVI8Equ3bUfiitOKOmo+xDLzPAZM6wj2BzXvh1fNXXkr7Zo/0lop1E+iz1Fb7r Z9CYFpaZfoltOhSytDqacgdjA6UsqchzZfif0SpJLKJ6AdRNC3pgf0m+SCSO4+RmAxxz fLi6YNA15dGhgBbZ6s6FhWjVgo30M0B9qJFOkPTqMP+atiN3cViYalsEQJxy6CS3Kqcl NOPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=avbzSqBN6l065xwVS/gMbrbDT49h+waHLKF67mPw7qo=; b=0UYjriBAaRfCbvyuZGnQjYFP2ju2dI8X0E3zQGeRAeKOenBk0qVk/lCXYQ5bI8jpHS epxHsDzlNwGSYpGi5uIDau1h/dWddRu1ccJmiFbMnLZKPKS5YI/eQzHLMYBAW+/InUL4 p3kbdESqDPQkZ077xCs4WoC/p/rLNHS8RC7N2To6zEdMPGUreEGrwI5a5Bwk9D1ZmM2q NmM3L6hwTDXW/aEwSRRXMUVI3PAkKtKCCKwiigj5Aj0JYu+giPCq0xa7S7Fx9dfCTy/h 1DXLlQtmbae5hUb+iE7xdoNw+R7RLyfbmvXDN3wPTSrbIIRXqzOH8RmjI6jXv7mMn+Ng b6bg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14-v6si1325416plm.20.2018.02.09.01.31.09; Fri, 09 Feb 2018 01:31:26 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752699AbeBIJ3e (ORCPT + 99 others); Fri, 9 Feb 2018 04:29:34 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46082 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751093AbeBIJ1h (ORCPT ); Fri, 9 Feb 2018 04:27:37 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8110540265FD; Fri, 9 Feb 2018 09:27:36 +0000 (UTC) Received: from krava (unknown [10.43.17.63]) by smtp.corp.redhat.com (Postfix) with SMTP id CB3F4DEEF2; Fri, 9 Feb 2018 09:27:34 +0000 (UTC) Date: Fri, 9 Feb 2018 10:27:34 +0100 From: Jiri Olsa To: Stephane Eranian Cc: Arnaldo Carvalho de Melo , Jiri Olsa , lkml , Ingo Molnar , Namhyung Kim , David Ahern , Andi Kleen , Alexander Shishkin , Peter Zijlstra Subject: [PATCH] perf report: Add support to display group output for non group events Message-ID: <20180209092734.GB20449@krava> References: <20180202202849.GA8297@kernel.org> <20180202204004.GB8297@kernel.org> <20180205151720.GA29340@krava> <20180205211340.GD25353@kernel.org> <20180206093553.GA8065@krava> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 09 Feb 2018 09:27:36 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Fri, 09 Feb 2018 09:27:36 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'jolsa@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 07, 2018 at 10:52:35AM -0800, Stephane Eranian wrote: SNIP > >> Similar to what I get if I do instead: > >> $ perf record -e '{branches,branches,branches,branches}' my_test > >> $ perf report --group > >> > >> But here, I would have to ensure all events fits in a group to allow > >> the reporting > >> I want. So that would limit me to 4 events. > >> > >> I think perf report --group should work regardless of how the events > >> were grouped. > >> Is there already a way to work around this? > > > > no workaround.. please try attached patch, it seems > > to work for what you described > > > Works for me. That's great! > Thanks. > > Tested-By: Stephane Eranian thanks, full patch attached jirka --- Add support to display group output for if non grouped events are detected and user forces --group option. Now for non-group events recorded like: $ perf record -e 'cycles,instructions' ls you can still get group output by using --group option in report: $ perf report --group --stdio ... # Overhead Command Shared Object Symbol # ................ ....... ................ ...................... # 17.67% 0.00% ls libc-2.25.so [.] _IO_do_write@@GLIB 15.59% 25.94% ls ls [.] calculate_columns 15.41% 31.35% ls libc-2.25.so [.] __strcoll_l ... Requested-and-Tested-by: Stephane Eranian Link: http://lkml.kernel.org/n/tip-m1ffikw8c3a55b3uaxrmk5w3@git.kernel.org Signed-off-by: Jiri Olsa --- tools/perf/Documentation/perf-report.txt | 3 ++- tools/perf/builtin-report.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 907e505b6309..a76b871f78a6 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt @@ -354,7 +354,8 @@ OPTIONS Path to objdump binary. --group:: - Show event group information together. + Show event group information together. It forces group output also + if there are no groups defined in data file. --demangle:: Demangle symbol names to human readable form. It's enabled by default, diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 8ef71669e7a0..1eedb1815c4c 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c @@ -938,6 +938,7 @@ int cmd_report(int argc, const char **argv) "perf report []", NULL }; + bool group_set = false; struct report report = { .tool = { .sample = process_sample_event, @@ -1057,7 +1058,7 @@ int cmd_report(int argc, const char **argv) "Specify disassembler style (e.g. -M intel for intel syntax)"), OPT_BOOLEAN(0, "show-total-period", &symbol_conf.show_total_period, "Show a column with the sum of periods"), - OPT_BOOLEAN(0, "group", &symbol_conf.event_group, + OPT_BOOLEAN_SET(0, "group", &symbol_conf.event_group, &group_set, "Show event group information together"), OPT_CALLBACK_NOOPT('b', "branch-stack", &branch_mode, "", "use branch records for per branch histogram filling", @@ -1174,6 +1175,9 @@ int cmd_report(int argc, const char **argv) has_br_stack = perf_header__has_feat(&session->header, HEADER_BRANCH_STACK); + if (group_set && !session->evlist->nr_groups) + perf_evlist__set_leader(session->evlist); + if (itrace_synth_opts.last_branch) has_br_stack = true; -- 2.13.6