Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752043AbbLRJdY (ORCPT ); Fri, 18 Dec 2015 04:33:24 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:34928 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751971AbbLRJbU (ORCPT ); Fri, 18 Dec 2015 04:31:20 -0500 MIME-Version: 1.0 In-Reply-To: <20151218015538.GC15533@two.firstfloor.org> References: <1450227266-2501-1-git-send-email-andi@firstfloor.org> <20151217140123.GA15533@two.firstfloor.org> <20151218015538.GC15533@two.firstfloor.org> Date: Fri, 18 Dec 2015 01:31:18 -0800 Message-ID: Subject: Re: Add top down metrics to perf stat v2 From: Stephane Eranian To: Andi Kleen Cc: Arnaldo Carvalho de Melo , Peter Zijlstra , Jiri Olsa , Ingo Molnar , LKML , Namhyung Kim Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4964 Lines: 130 Andi, On Thu, Dec 17, 2015 at 5:55 PM, Andi Kleen wrote: > Thanks for testing. > > > On Thu, Dec 17, 2015 at 03:31:30PM -0800, Stephane Eranian wrote: >> I would not add a --topdown option but instead a --metric option with arguments >> such that other metrics could be added later: >> >> $ perf stat --metrics topdown -I 1000 -a sleep 100 >> >> If you do this, you do not need the --metric-only option > > The --metric-only option is useful with other metrics too. For example > to get concise (and plottable) IPC or TSX abort statistics. See the > examples in the original commit. > > However could make --topdown default to --metric-only and add > an option to turn it off. Yes that's probably a better default > for more people, although some people could be annoyed by the > wide output. > >> The double --topdown is confusing. > > Ok. I was thinking of changing it and adding an extra argument for > the "ignore threshold" behavior. That would also make it more extensible > if we ever add Level 2. > I think you should drop that implicit threshold data suppression feature altogether. See what I write below. >> >> Why force --per-core when HT is on. I know you you need to aggregate >> per core, but >> you could still display globally. And then if user requests >> --per-core, then display per core. > > Global TopDown doesn't make much sense. Suppose you have two programs > running on different cores, one frontend bound and one backend bound. > What would the union of the two mean? And you may well end up > with sums of ratios which are >100%. > How could that be if you consider that the machine is N-wide and not just 4-wide anymore? How what you are describing here is different when HT is off? If you force --per-core with HT-on, then you need to force it too when HT is off so that you get a similar per core breakdown. In the HT on case, each Sx-Cy represents 2 threads, compared to 1 in the non HT case.Right now, you have non-HT reporting global, HT reporting per-core. That does not make much sense to me. > The only exception where it's useful is for the single threaded > case (like the toplev --single-thread) option. However it is something > ugly and difficult because the user would need to ensure that there is > nothing active on the sibling thread. So I left it out. > >> Same if user specifies --per-socket. I know this requires some more >> plumbing inside perf >> but it would be clearer and simpler to interpret to users. > > Same problem as above. > >> >> One bug I found when testing is that if you do with HT-on: >> >> $ perf stat -a --topdown -I 1000 --metric-only sleep 100 >> Then you get data for frontend and backend but nothing for retiring or >> bad speculation. > > You see all the columns, but no data in some? > yes, and I don't like that. It is confusing especially when you do not know the threshold. Why are you suppressing the 'retiring' data when it is at 25% (1/4 of the maximum possible) when I am running a simple noploop? 25% is a sign of underutilization, that could be useful too. Furthermore, it makes it harder to parse, including with the -x option because some fields may not be there. I would rather see all the values. In non -x mode, you could use color to indicate high/low thresholds (similar to perf report). > That's intended: the percentage is only printed when it crosses a > threshold. That's part of the top down specification. > I don't like that. I would rather see all the percentages. My remark applies to non topdown metrics as well, such as IPC. Clearly the IPC is awkward to use. You need to know you need to measure cycles, instructions to get ipc with --metric-only. Again, I would rather see: $ perf stat --metrics ipc .... $ perf stat --metrics topdown It is more uniform and users do not have to worry about what events to use to compute a metric. As an example, here is what you could do (showing side by side metrics ipc and uops/cycles): # perf stat -a --metric ipc,upc -I 1000 sleep 100 #====================================== # | ipc| upc # | IPC %Peak| UPC # | ^ ^ | ^ #====================================== 1.006038929 0.21 5.16% 0.60 2.012169514 0.21 5.31% 0.60 3.018314389 0.20 5.08% 0.59 4.024430081 0.21 5.26% 0.60 >> I suspect it is because you expect --metric-only to be used only when >> you have the >> double --topdown. That's why I think this double topdown is confusing. If you do >> as I suggest, it will be much simpler. > > It works fine with single topdown as far as I can tell. > > > -Andi > -- > ak@linux.intel.com -- Speaking for myself only. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/