Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp877289lql; Mon, 11 Mar 2024 23:49:29 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXRAHUSlF2D2P8RXtSWaBBkVqqvja1JUw1zfbSeEDmo+FHKNU5ADxyNE7gIcS9CoDCqOGJaYASSUJWnRh8RqBeTbxF1rlpM8lzMDP/KBg== X-Google-Smtp-Source: AGHT+IE7+bIE/dnddTRGC9IcEFsKM/Cn9379Nuy6LlywkIJWS/1IqhPzG6cgBtMrZVVETkHIn+lT X-Received: by 2002:a05:6808:640e:b0:3c2:4c5c:854 with SMTP id fg14-20020a056808640e00b003c24c5c0854mr5810691oib.45.1710226169236; Mon, 11 Mar 2024 23:49:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710226169; cv=pass; d=google.com; s=arc-20160816; b=A+/+NcSnXhLxg6dDRQRrRbbqVmNUriwaec+mDquyivpXuSViyJEkKBQ8axaPrMKnxY NXliZfgbvb9TjY3xNXNaLPe6SaMvg3zOHX+rdBzFPBqPQYKFfL/AN2g0OHJ9N9GreefJ 5RqFT5EbMPXtg9oYdluCixsMmAVx73yLLZum/NybIVgujUX65yXbkclTP4JpQHxyh+mH 1ZvkUF3quyD1u9U5Wqgana7lyLmMtf3c4oYnVXkxvfN7ecbM6sr44ucO2NWMJJcSpxxr jmplRPK0u6prM6lV+2wyOIJTH3Eu//ph2yHpExmdIuTyTix98EbglTAegldBBqDiwmR3 J64Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence; bh=dcrdLEFHw+u0g7KmoV4uvHmtfMU74jrO4Ftzic9JdHY=; fh=cgXEf5Up3R3D08sFXqPbufrWAxYUjvye/SwYqALvSCY=; b=ZNUda88oy2Ja8nOLKHT7SMfDib+rxShjF1bEVT2qBdVf67kM7sdpLFmJK4rqZE3rUI TVJ3MdlLB/N13qadj/96fH0pHoGJ79PG+a3sE/wTmrPjIV3zt3122vX3akL00jZjKAL1 7nZF++a/YEuju1LVpy84sGbqkTPaoeLl3buUfGhto5QriBnpCvqWtAx6uBb6AJ8hrWwG F+CvmGB9pqv0+COidNCOA6NAFhHdjHGQKRgssgl2DE+O2UNQNZrdtlYVzKYpQLDq7cSy g2yNytETeJnqQhnVYXjUxdz0UZkrnvZRQX8UT7tMgPtrrDOTl4+tvn+EeOLEjaE+c2zm A+5A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99900-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 62-20020a630241000000b005dbf27229edsi6121226pgc.290.2024.03.11.23.49.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 23:49:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-99900-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-99900-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-99900-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DABA1281D9F for ; Tue, 12 Mar 2024 06:49:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CE2269953; Tue, 12 Mar 2024 06:49:21 +0000 (UTC) Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 468F169944; Tue, 12 Mar 2024 06:49:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710226160; cv=none; b=ht13XW5F49VDXK71gjpWCgca30CnDgIElpqQciHZp9JkXKGjNvL7p15gEDF+dBvYY72liwMOqQtM47RE2b8oIEGJg+RdmIV70/5kUR53K5n7ljI/mJwJORlWrBPaY/D5ClCOGrLzrzsfDJS9nZx35RzdSOsEwSlSyKSE4qBAXUs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710226160; c=relaxed/simple; bh=NpTpzOFpjTFaXZX5FuKeyjBow4yCTS2iQk19N51842M=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=qm6RATTZhK5q11FMjgwGyYUD4Qxn62wzHSKjCekh8+WtlFWCGBEz5JcjT/Pzoa2tnMPu70bCeJ3iwWCeeVHxsy7oSUYkxPAJ1HZThMdUWhVpHRuNda3m/2tcexCBhN9F98C0zHjq1PvFX3vfC5cwEYKC2x0/0752C+hWAbwoaZs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-5d8b887bb0cso4414152a12.2; Mon, 11 Mar 2024 23:49:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710226158; x=1710830958; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dcrdLEFHw+u0g7KmoV4uvHmtfMU74jrO4Ftzic9JdHY=; b=w+JzyRFAPkfsyHTDa7K2jJxbjZ2OMTpi2ey3NeG7PKw1/twG4l99XDfJok+8wPbGzf oysxQq3OO0A5lSPo/ryfCLVTYSLeSWFq6plnNkwZDMgChAmdQolJMPaCKeuio6nTmOiC Y5LaXs6LJ3ibuRAFVp8bI6tEfVj0Srm5VLY7DDXSBNaFoUquMd5yuSgzsnS9I9/0ij7p Unv1XD98YTxaVd+HFONypE8+n0AodXkeR0kq9ZZCzWyY7bObN1usXmlZa7wLicuaWHj/ AheWs1wzGIxX89qlHW/Kux5Ol2rNAMCaZnBrucmvo1DPf2xnmaHGUYJC+4B95gUFyK3u XQ0g== X-Forwarded-Encrypted: i=1; AJvYcCV7CKA792BUj2v8FumZXxp0apr1UL2avnFuG2nibVYQSwbpIPU/4z6CXrtBSSS8E8htGsjsZXEouSCfCZTe0GmLTEIUzrYR26Ql3Fczoh4+33EMXqpEvUE9MgpshbN1i+LnbAU4caZNMtGOze9MEA== X-Gm-Message-State: AOJu0YyFIf2KqGlxUtiwqadtAZ/jg9vATCykvcKvs0ShixhgD1pnDDO9 AfWokTctrVJ34WFvhI0Ycuk8pyB+w6tyLzPobpZFT6tIkU8c/J0P37LNgvtx85w2k1WoHnQjMiV XJl6tzNh9uLyFjJ86VF1VL6GULbs= X-Received: by 2002:a05:6a20:2443:b0:1a1:847f:8e8c with SMTP id t3-20020a056a20244300b001a1847f8e8cmr10907618pzc.20.1710226158531; Mon, 11 Mar 2024 23:49:18 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240302001139.604829-1-weilin.wang@intel.com> <20240302001139.604829-6-weilin.wang@intel.com> In-Reply-To: <20240302001139.604829-6-weilin.wang@intel.com> From: Namhyung Kim Date: Mon, 11 Mar 2024 23:49:07 -0700 Message-ID: Subject: Re: [RFC PATCH v3 5/6] perf stat: Add retire latency print functions to print out at the very end of print out To: weilin.wang@intel.com Cc: Ian Rogers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Perry Taylor , Samantha Alt , Caleb Biggers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Mar 1, 2024 at 4:11=E2=80=AFPM wrote: > > From: Weilin Wang > > Add print out functions so that users could read retire latency values. Can you please put some example output here? Thanks, Namhyung > > Signed-off-by: Weilin Wang > --- > tools/perf/util/stat-display.c | 65 ++++++++++++++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > > diff --git a/tools/perf/util/stat-display.c b/tools/perf/util/stat-displa= y.c > index bfc1d705f437..e2996ba67bfe 100644 > --- a/tools/perf/util/stat-display.c > +++ b/tools/perf/util/stat-display.c > @@ -21,6 +21,7 @@ > #include "iostat.h" > #include "pmu.h" > #include "pmus.h" > +#include "metricgroup.h" > > #define CNTR_NOT_SUPPORTED "" > #define CNTR_NOT_COUNTED "" > @@ -34,6 +35,7 @@ > #define COMM_LEN 16 > #define PID_LEN 7 > #define CPUS_LEN 4 > +#define RETIRE_LEN 8 > > static int aggr_header_lens[] =3D { > [AGGR_CORE] =3D 18, > @@ -426,6 +428,67 @@ static void print_metric_std(struct perf_stat_config= *config, > fprintf(out, " %-*s", METRIC_LEN - n - 1, unit); > } > > +static void print_retire_lat_std(struct perf_stat_config *config, > + struct outstate *os) > +{ > + FILE *out =3D os->fh; > + bool newline =3D os->newline; > + struct tpebs_retire_lat *t; > + struct list_head *retire_lats =3D &config->tpebs_results; > + > + list_for_each_entry(t, retire_lats, nd) { > + if (newline) > + do_new_line_std(config, os); > + fprintf(out, "%'*.2f %-*s", COUNTS_LEN, t->val, EVNAME_LE= N, t->name); > + fprintf(out, "%*ld %*d\n", RETIRE_LEN, t->count, > + RETIRE_LEN, t->sum); > + } > +} > + > +static void print_retire_lat_csv(struct perf_stat_config *config, > + struct outstate *os) > +{ > + FILE *out =3D os->fh; > + struct tpebs_retire_lat *t; > + struct list_head *retire_lats =3D &config->tpebs_results; > + const char *sep =3D config->csv_sep; > + > + list_for_each_entry(t, retire_lats, nd) { > + fprintf(out, "%f%s%s%s%s%ld%s%d\n", t->val, sep, sep, t->= name, sep, > + t->count, sep, t->sum); > + } > +} > + > +static void print_retire_lat_json(struct perf_stat_config *config, > + struct outstate *os) > +{ > + FILE *out =3D os->fh; > + struct tpebs_retire_lat *t; > + struct list_head *retire_lats =3D &config->tpebs_results; > + > + fprintf(out, "{"); > + list_for_each_entry(t, retire_lats, nd) { > + fprintf(out, "\"retire_latency-value\" : \"%f\", ", t->va= l); > + fprintf(out, "\"event-name\" : \"%s\"", t->name); > + fprintf(out, "\"sample-counts\" : \"%ld\"", t->count); > + fprintf(out, "\"retire_latency-sum\" : \"%d\"", t->sum); > + } > + fprintf(out, "}"); > +} > + > +static void print_retire_lat(struct perf_stat_config *config, > + struct outstate *os) > +{ > + if (!&config->tpebs_results) > + return; > + if (config->json_output) > + print_retire_lat_json(config, os); > + else if (config->csv_output) > + print_retire_lat_csv(config, os); > + else > + print_retire_lat_std(config, os); > +} > + > static void new_line_csv(struct perf_stat_config *config, void *ctx) > { > struct outstate *os =3D ctx; > @@ -1609,6 +1672,8 @@ void evlist__print_counters(struct evlist *evlist, = struct perf_stat_config *conf > break; > } > > + print_retire_lat(config, &os); > + > print_footer(config); > > fflush(config->output); > -- > 2.43.0 >