From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C2ED6C433F5 for ; Mon, 29 Nov 2021 17:12:27 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4J2sNV0HTsz3cSK for ; Tue, 30 Nov 2021 04:12:26 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=A0cMLHlB; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=A0cMLHlB; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=jolsa@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=A0cMLHlB; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=A0cMLHlB; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4J2sMj4wXpz2xtR for ; Tue, 30 Nov 2021 04:11:44 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638205900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YQeXdayCnkvjWc51N14x/4MfGt9KFvQgOqWRPynFEGY=; b=A0cMLHlBi5ijMEFfeK5H8cyMUGtYNXWjoVqGMKHGQ/sm4C28Mw76tWLNUHdCMDsVO5TtNU 9REoGzQpU0UfBdvImOH661RWvpa30T3s9VhZ5y3/YbWEeHQ8Gk6X0A8pPhXeLqWEdZQgUA OgbevyZWtofpgZRzTAUUIaeyUB7yg/E= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1638205900; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=YQeXdayCnkvjWc51N14x/4MfGt9KFvQgOqWRPynFEGY=; b=A0cMLHlBi5ijMEFfeK5H8cyMUGtYNXWjoVqGMKHGQ/sm4C28Mw76tWLNUHdCMDsVO5TtNU 9REoGzQpU0UfBdvImOH661RWvpa30T3s9VhZ5y3/YbWEeHQ8Gk6X0A8pPhXeLqWEdZQgUA OgbevyZWtofpgZRzTAUUIaeyUB7yg/E= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-382-04GU3AQfOue08cAus1WiZw-1; Mon, 29 Nov 2021 12:11:38 -0500 X-MC-Unique: 04GU3AQfOue08cAus1WiZw-1 Received: by mail-wm1-f70.google.com with SMTP id a85-20020a1c7f58000000b0033ddc0eacc8so10305690wmd.9 for ; Mon, 29 Nov 2021 09:11:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=YQeXdayCnkvjWc51N14x/4MfGt9KFvQgOqWRPynFEGY=; b=ZhHM3sWF/qnnXIL+hlWT+uomvJ25e1nDsMztFW5zhbXG80A6pA9KM88/7kA1pr8u1Z 3EPh982gl6/0aIYBh+rwCNDGKw5P6xMf4fiCaP12WLVLogG+riZIqL1Bn+qhin5FE2ex 4EpaB/Qq+tv9ymkQZcgfpPnpcz/Ybke4AK8j9v6sXZloP+EM/hRa1qLJDK1nPyCc1hBK AnkKwD6Jafjj09JUgMpWZN8jAN3qgAz/EQIWeOdinc8qZyydsq2OaCzJuVZIgG41a3WN bJnQNkvg4ZVE1XPj+mcCYnouV4/82XwNwkxe9Q85PpFiihHxu6fjCdT9vtvQC2Rt9Nfu 3uzw== X-Gm-Message-State: AOAM533zK2RpjNLedYI/wna/qH9/7e+qNJO8u2WGew4MyeWOGU/eo2uX G9Ku5T28CKclncpyu75OAlfx4vSoL2vOjllL8wfquIVF8znybK+8x2Reoc/QkZLNiAuR62Ab+q4 cWWeHj/tEbo9RcR24FhApLP2QiQ== X-Received: by 2002:adf:fbc5:: with SMTP id d5mr38118076wrs.291.1638205896890; Mon, 29 Nov 2021 09:11:36 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHpkPDO/3JJftsa0KO/wQW2joNogZAU7drv1A4fLjU/VAKwmh8O+A4HaIDtCq1J/G2bry+DQ== X-Received: by 2002:adf:fbc5:: with SMTP id d5mr38118039wrs.291.1638205896656; Mon, 29 Nov 2021 09:11:36 -0800 (PST) Received: from krava (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id k187sm272819wme.0.2021.11.29.09.11.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Nov 2021 09:11:33 -0800 (PST) Date: Mon, 29 Nov 2021 18:11:31 +0100 From: Jiri Olsa To: Athira Rajeev Subject: Re: [PATCH 1/2] tools/perf: Include global and local variants for p_stage_cyc sort key Message-ID: References: <20211125024851.22895-1-atrajeev@linux.vnet.ibm.com> MIME-Version: 1.0 In-Reply-To: <20211125024851.22895-1-atrajeev@linux.vnet.ibm.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: maddy@linux.vnet.ibm.com, rnsastry@linux.ibm.com, acme@kernel.org, linux-perf-users@vger.kernel.org, jolsa@kernel.org, kjain@linux.ibm.com, namhyung@kernel.org, linuxppc-dev@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Thu, Nov 25, 2021 at 08:18:50AM +0530, Athira Rajeev wrote: > Sort key p_stage_cyc is used to present the latency > cycles spend in pipeline stages. perf tool has local > p_stage_cyc sort key to display this info. There is no > global variant available for this sort key. local variant > shows latency in a sinlge sample, whereas, global value > will be useful to present the total latency (sum of > latencies) in the hist entry. It represents latency > number multiplied by the number of samples. > > Add global (p_stage_cyc) and local variant > (local_p_stage_cyc) for this sort key. Use the > local_p_stage_cyc as default option for "mem" sort mode. > Also add this to list of dynamic sort keys. > > Signed-off-by: Athira Rajeev > Reported-by: Namhyung Kim > --- > tools/perf/util/hist.c | 4 +++- > tools/perf/util/hist.h | 3 ++- > tools/perf/util/sort.c | 34 +++++++++++++++++++++++++--------- > tools/perf/util/sort.h | 3 ++- > 4 files changed, 32 insertions(+), 12 deletions(-) > > diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c > index b776465e04ef..0a8033b09e28 100644 > --- a/tools/perf/util/hist.c > +++ b/tools/perf/util/hist.c > @@ -211,7 +211,9 @@ void hists__calc_col_len(struct hists *hists, struct hist_entry *h) > hists__new_col_len(hists, HISTC_MEM_BLOCKED, 10); > hists__new_col_len(hists, HISTC_LOCAL_INS_LAT, 13); > hists__new_col_len(hists, HISTC_GLOBAL_INS_LAT, 13); > - hists__new_col_len(hists, HISTC_P_STAGE_CYC, 13); > + hists__new_col_len(hists, HISTC_LOCAL_P_STAGE_CYC, 13); > + hists__new_col_len(hists, HISTC_GLOBAL_P_STAGE_CYC, 13); > + > if (symbol_conf.nanosecs) > hists__new_col_len(hists, HISTC_TIME, 16); > else > diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h > index 5343b62476e6..2752ce681108 100644 > --- a/tools/perf/util/hist.h > +++ b/tools/perf/util/hist.h > @@ -75,7 +75,8 @@ enum hist_column { > HISTC_MEM_BLOCKED, > HISTC_LOCAL_INS_LAT, > HISTC_GLOBAL_INS_LAT, > - HISTC_P_STAGE_CYC, > + HISTC_LOCAL_P_STAGE_CYC, > + HISTC_GLOBAL_P_STAGE_CYC, > HISTC_NR_COLS, /* Last entry */ > }; > > diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c > index e9216a292a04..e978f7883e07 100644 > --- a/tools/perf/util/sort.c > +++ b/tools/perf/util/sort.c > @@ -37,7 +37,7 @@ const char default_parent_pattern[] = "^sys_|^do_page_fault"; > const char *parent_pattern = default_parent_pattern; > const char *default_sort_order = "comm,dso,symbol"; > const char default_branch_sort_order[] = "comm,dso_from,symbol_from,symbol_to,cycles"; > -const char default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked,blocked,local_ins_lat,p_stage_cyc"; > +const char default_mem_sort_order[] = "local_weight,mem,sym,dso,symbol_daddr,dso_daddr,snoop,tlb,locked,blocked,local_ins_lat,local_p_stage_cyc"; > const char default_top_sort_order[] = "dso,symbol"; > const char default_diff_sort_order[] = "dso,symbol"; > const char default_tracepoint_sort_order[] = "trace"; > @@ -46,8 +46,8 @@ const char *field_order; > regex_t ignore_callees_regex; > int have_ignore_callees = 0; > enum sort_mode sort__mode = SORT_MODE__NORMAL; > -const char *dynamic_headers[] = {"local_ins_lat", "p_stage_cyc"}; > -const char *arch_specific_sort_keys[] = {"p_stage_cyc"}; > +const char *dynamic_headers[] = {"local_ins_lat", "ins_lat", "local_p_stage_cyc", "p_stage_cyc"}; so you also add global ins_lat, right? will this change some default behaviour? > +const char *arch_specific_sort_keys[] = {"local_p_stage_cyc", "p_stage_cyc"}; nit.. both dynamic_headers and arch_specific_sort_keys could be static right? thanks, jirka > > /* > * Replaces all occurrences of a char used with the: > @@ -1392,22 +1392,37 @@ struct sort_entry sort_global_ins_lat = { > }; > > static int64_t > -sort__global_p_stage_cyc_cmp(struct hist_entry *left, struct hist_entry *right) > +sort__p_stage_cyc_cmp(struct hist_entry *left, struct hist_entry *right) > { > return left->p_stage_cyc - right->p_stage_cyc; > } > > +static int hist_entry__global_p_stage_cyc_snprintf(struct hist_entry *he, char *bf, > + size_t size, unsigned int width) > +{ > + return repsep_snprintf(bf, size, "%-*u", width, > + he->p_stage_cyc * he->stat.nr_events); > +} > + > + > static int hist_entry__p_stage_cyc_snprintf(struct hist_entry *he, char *bf, > size_t size, unsigned int width) > { > return repsep_snprintf(bf, size, "%-*u", width, he->p_stage_cyc); > } > > -struct sort_entry sort_p_stage_cyc = { > - .se_header = "Pipeline Stage Cycle", > - .se_cmp = sort__global_p_stage_cyc_cmp, > +struct sort_entry sort_local_p_stage_cyc = { > + .se_header = "Local Pipeline Stage Cycle", > + .se_cmp = sort__p_stage_cyc_cmp, > .se_snprintf = hist_entry__p_stage_cyc_snprintf, > - .se_width_idx = HISTC_P_STAGE_CYC, > + .se_width_idx = HISTC_LOCAL_P_STAGE_CYC, > +}; > + > +struct sort_entry sort_global_p_stage_cyc = { > + .se_header = "Pipeline Stage Cycle", > + .se_cmp = sort__p_stage_cyc_cmp, > + .se_snprintf = hist_entry__global_p_stage_cyc_snprintf, > + .se_width_idx = HISTC_GLOBAL_P_STAGE_CYC, > }; > > struct sort_entry sort_mem_daddr_sym = { > @@ -1858,7 +1873,8 @@ static struct sort_dimension common_sort_dimensions[] = { > DIM(SORT_CODE_PAGE_SIZE, "code_page_size", sort_code_page_size), > DIM(SORT_LOCAL_INS_LAT, "local_ins_lat", sort_local_ins_lat), > DIM(SORT_GLOBAL_INS_LAT, "ins_lat", sort_global_ins_lat), > - DIM(SORT_PIPELINE_STAGE_CYC, "p_stage_cyc", sort_p_stage_cyc), > + DIM(SORT_LOCAL_PIPELINE_STAGE_CYC, "local_p_stage_cyc", sort_local_p_stage_cyc), > + DIM(SORT_GLOBAL_PIPELINE_STAGE_CYC, "p_stage_cyc", sort_global_p_stage_cyc), > }; > > #undef DIM > diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h > index 3c7518378d62..83abe5e6812a 100644 > --- a/tools/perf/util/sort.h > +++ b/tools/perf/util/sort.h > @@ -235,7 +235,8 @@ enum sort_type { > SORT_CODE_PAGE_SIZE, > SORT_LOCAL_INS_LAT, > SORT_GLOBAL_INS_LAT, > - SORT_PIPELINE_STAGE_CYC, > + SORT_LOCAL_PIPELINE_STAGE_CYC, > + SORT_GLOBAL_PIPELINE_STAGE_CYC, > > /* branch stack specific sort keys */ > __SORT_BRANCH_STACK, > -- > 2.27.0 >