Received: by 10.223.176.5 with SMTP id f5csp155436wra; Mon, 5 Feb 2018 18:53:10 -0800 (PST) X-Google-Smtp-Source: AH8x227V8eqSdKYpmwrBf9DFVmuzyZOMzAo/VuKs2+wTDu03AxXhdD0/Q77vY3nUOofRkSqLVcGp X-Received: by 10.101.76.143 with SMTP id m15mr721012pgt.445.1517885590195; Mon, 05 Feb 2018 18:53:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517885590; cv=none; d=google.com; s=arc-20160816; b=H2wdMZgnLOc+1/fH4G3CWkZFP0lNUxFlwZiik/yp0U3Y6PJgO4xRity7GNk1gPJzNw jgrdA/+xTkKFcSDCSunoa8fBWBg5bF3fdSdEloLV/74vXTNMGi21OqZ/Dp1ojIkwqQMj BVi7udB9hgd6bDL/N1H0KnJSgJRUzA0f/Hu7l2QqEw+KsaMwphcBoavIX1M2jdcd4J7z gfYr0gEO0DiJ29BqET1QSCbQJWfjlt5stfEHwlK4mLe+1xbR22gjTjIUTz3eqrj7k/rc XjXM7tUGDCQ4pKCkhNo9gedSvyZKu7Xycjw1DeR20PWORT1i7HxL1s3zxLc/X8gwuDDU Ebag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=fuNZVRWjRH4nnFvE8YX9Y8/p+N6Stb5c04M++yWBeXw=; b=IGKk18CLLAYXOK7frwWuvJvxgYa6YxabXtt8c60dX69t3XiVG+CqU/kOKmRlH6eQZY CcihpBReZiGDYkhmnauU9gcLXk612kdd3tMf8P9eUzWCpfp1FKvInpUiF5V+blkteQuj EPRaStY+y027YBEoVbHGV/xZAM4MrisXIJVA8o7D8KLm82UKfNcepwjeqRbBgWhM1Xz+ ET3moDMQqwnFgX7BbBk30AkhF21TafDM6M0ueUWaS+bacqnibJLPkky1CDDeUvrbJLXx rA6g7sdG9vo34wM0ZbIGgllTwHbBSEhxck000mL1r5mKBYr0hMry6XmDHxxogSMNMzON 09+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=IsaBVR4J; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s13-v6si945196plp.787.2018.02.05.18.52.55; Mon, 05 Feb 2018 18:53:10 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=IsaBVR4J; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752210AbeBFCvM (ORCPT + 99 others); Mon, 5 Feb 2018 21:51:12 -0500 Received: from mail-it0-f66.google.com ([209.85.214.66]:52798 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752009AbeBFCvG (ORCPT ); Mon, 5 Feb 2018 21:51:06 -0500 Received: by mail-it0-f66.google.com with SMTP id o13so341824ito.2 for ; Mon, 05 Feb 2018 18:51:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=fuNZVRWjRH4nnFvE8YX9Y8/p+N6Stb5c04M++yWBeXw=; b=IsaBVR4JwEHEuDIetdhQJ40zxYCZYiOsSwRmdtDEx9YMx2/Jk9QJDmn81vXCbtDy1O VwJgBBL7dBUvIiS0Hg0m3REMDpxha/zd27TOk47crOqWgOmsKwxaXuJHB+sSOBfwzoQI orbuR1aNsr5nLFdyjE7xSQLmB0EKXj/gDzA+AtvqwP+pYyd77+9HNO31CnnwQx0IPooU nUEh5y3tNVSZ0OLpDon7qy6GKnYkvK++KDBgUq8sTbRdEkJ5md7b3ewxmO8t5JyEssXb BKFzp0UPIyBBdk6mRKSvPdNbWFfLrcG8pV/2iTZKXZi/0dR8mqY6xXbx6s+JGHhnskYR qH8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fuNZVRWjRH4nnFvE8YX9Y8/p+N6Stb5c04M++yWBeXw=; b=svOag5qLY45Wna7sKlqHyeGot6AHCWmm9HBe8DNqzmgg1i2BAiCEYUUOY6NrJoNiCt g9isYpUvulBrKWxgCnOn/GcLtE8XNxpGrkr3Wq0Yiz0fol87UUA/mpx9AWxymXMBSt56 T4s3qJ3iiMJ3wFmkPuhQuBs3h/GDbDGJBeHwtfOy1jGIMm7Fd2GaPF3JnB2ExBhWJADp eMzlOwQ0HhF9yNaqrLWE5lADMfjw+5oEYcQObpL3TDAsZFZf7wY7zf3GMWuHfWrDlw8j likJRYbOubzlwjdWSP4WsiCAekC4fRslWgVXTghGIRo4BzpD90NKtKTrCuf7vsunsmP7 puRg== X-Gm-Message-State: APf1xPBWnhYuaQC4HpBfCd+GvRRxkDnLw7twCSNoya0Fcf/rSYSn2SQn eFI46dftHNMTY2iRpqUsNcAkOK1fFJPaQ/argnwz6g== X-Received: by 10.36.37.84 with SMTP id g81mr1141383itg.73.1517885465560; Mon, 05 Feb 2018 18:51:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.170.39 with HTTP; Mon, 5 Feb 2018 18:51:05 -0800 (PST) In-Reply-To: <20180205211340.GD25353@kernel.org> References: <20180201083812.11359-1-jolsa@kernel.org> <20180201083812.11359-2-jolsa@kernel.org> <20180202202849.GA8297@kernel.org> <20180202204004.GB8297@kernel.org> <20180205151720.GA29340@krava> <20180205211340.GD25353@kernel.org> From: Stephane Eranian Date: Mon, 5 Feb 2018 18:51:05 -0800 Message-ID: Subject: Re: [PATCH 1/3] perf tools: Fix period/freq terms setup To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Jiri Olsa , lkml , Ingo Molnar , Namhyung Kim , David Ahern , Andi Kleen , Alexander Shishkin , Peter Zijlstra Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 5, 2018 at 1:13 PM, Arnaldo Carvalho de Melo wrote: > Em Mon, Feb 05, 2018 at 12:58:16PM -0800, Stephane Eranian escreveu: >> On Mon, Feb 5, 2018 at 7:17 AM, Jiri Olsa wrote: >> > On Fri, Feb 02, 2018 at 01:04:34PM -0800, Stephane Eranian wrote: >> >> On Fri, Feb 2, 2018 at 12:40 PM, Arnaldo Carvalho de Melo >> >> wrote: >> >> > Em Fri, Feb 02, 2018 at 05:28:49PM -0300, Arnaldo Carvalho de Melo escreveu: >> >> >> Em Fri, Feb 02, 2018 at 10:45:46AM -0800, Stephane Eranian escreveu: >> >> >> > Otherwise, I tested what you have written so far and it works. >> >> > >> >> >> So I take that as a Tested-by: Stephane and will apply the patches, Jiri >> >> >> can continue working on these other aspects, right? >> >> > >> >> > I also added this for the casual reader to get up to speed more quickly, >> >> > please check that it makes sense. >> >> > >> >> > Committer note: >> >> > >> >> > When we use -c or a period=N term in the event definition, then we don't >> >> > need to ask the kernel, via perf_event_attr.sample_type |= >> >> > PERF_SAMPLE_PERIOD, to put the event period in each sample, as we know >> >> > it already, it is in perf_event_attr.sample_period. >> >> > >> >> Not quite. It depends on how each event is setup. I can mix & match period >> >> and frequency. The PERF_SAMPLE_PERIOD can be dropped only if all the >> >> events use a fixed period either via period=N or -c. > >> > I think you can have both period and freq based event in one session >> > if that's your concern..? what would be the problem? > >> My understanding was that perf only support configs where all events >> have the same attr.sample_type. With frequency mode, you'd want the period >> recorded in some cases. > > [root@jouet ~]# perf record -e cycles/period=2/,instructions/freq=100/ > ^C[ perf record: Woken up 1 times to write data ] > [ perf record: Captured and wrote 1.895 MB perf.data (122 samples) ] > > [root@jouet ~]# perf report > [root@jouet ~]# perf evlist -v > cycles/period=2/: size: 112, { sample_period, sample_freq }: 2, sample_type: IP|TID|TIME|CPU|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1 > instructions/freq=100/: size: 112, config: 0x1, { sample_period, sample_freq }: 100, sample_type: IP|TID|TIME|CPU|PERIOD|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, freq: 1, sample_id_all: 1, exclude_guest: 1 > [root@jouet ~]# > Looks like this is working then, great! Now, related to profiling and reporting. There is still an issue I keep running into with grouping. I want to sample on N events, where N > number of hw counters. Yet I want the same output as perf report --group, i.e., side-by-side profiles as opposed to showing me one event profile at a time (which is not very useful). You should not require events to belong to the same group to support this. Many other tools support such output (e.g., VTUNE, Gooda). It is still very valuable even though events may not have been measured at the same time. Let me use a simple (and silly but portable) example. Today if I do on Intel x86: $ perf record -e branches,branches,branches,branches,branches my_test And I do: $ perf report --group It will show me 5 distinct profiles. I would like perf to show me a single profile where the 5 events are side-by-side. 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? Thanks. > commit ff3d527cebc1fa3707c617bfe9e74f53fcfb0955 > Author: Adrian Hunter > Date: Tue Aug 27 11:23:07 2013 +0300 > > perf: make events stream always parsable > > The event stream is not always parsable because the format of a sample > is dependent on the sample_type of the selected event. When there is > more than one selected event and the sample_types are not the same then > parsing becomes problematic. A sample can be matched to its selected > event using the ID that is allocated when the event is opened. > Unfortunately, to get the ID from the sample means first parsing it. > > This patch adds a new sample format bit PERF_SAMPLE_IDENTIFER that puts > the ID at a fixed position so that the ID can be retrieved without > parsing the sample. For sample events, that is the first position > immediately after the header. For non-sample events, that is the last > position. > > In this respect parsing samples requires that the sample_type and ID > values are recorded. For example, perf tools records struct > perf_event_attr and the IDs within the perf.data file. Those must be > read first before it is possible to parse samples found later in the > perf.data file. > > Signed-off-by: Adrian Hunter > Tested-by: Stephane Eranian > Acked-by: Peter Zijlstra >