From patchwork Thu Feb 2 19:22:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 52153 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp431851wrn; Thu, 2 Feb 2023 11:35:53 -0800 (PST) X-Google-Smtp-Source: AK7set85nD5WfXJG/W5WY+d51OpMBaBlf0+SMVTH9Ydj3Xra8LkxUsnDOHxKOIdB5sFEJ+emdvNS X-Received: by 2002:aa7:d953:0:b0:499:9d31:8490 with SMTP id l19-20020aa7d953000000b004999d318490mr7410372eds.24.1675366553715; Thu, 02 Feb 2023 11:35:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675366553; cv=none; d=google.com; s=arc-20160816; b=AjLdpaMEB2yaeJ3EReCUNg//Qe2VJzT4HP4DWexkMlG0pqbxsX5BpB7g8U7D+r6x4W c8quhF8aRL2EE1L5HxW2br58MA/3qp5PcluYnWUK+eD2Jf6t0TbrZY4t0lixZTterolZ /RJdjYTJVgBS2Yr/0KuoVJy70qIQ7ohelP5cQTJ6VKG+7T4cTN4sSBYo4sYmMSGrw5/q RJjVlbNPGyIwGOsB92gV5cNN9Ak6DC2tRP0GkfUbCnq4J3tfq4PZdoAMIm8wtvp/QGox EIuH6HNlxtKnrd6Pmrykjx+zRXNVg0cQOSRm2g5ZhUup4YnSsiqCc3QbAluXlmpmCYTG xEtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ZnCgMwN8fsUbusbtjtyrW6O3HpxBV6NtKCGlUu99ZVQ=; b=otuJ1bSNRq53xisGMvyhG4xoD4V9CJaIDaPevbVYwOBgTbbm9GS3l7uApdNbL4fcZZ XdkQAYznPYmK8wWUJtnlKz8FgfBprA4iVv8oIJSn/TVemFU8HMmR5/bBMI7QP4299459 4yqqfBFjUNpva5lZ7q+AnHsgEnK0ruSJnBvi3M5AYPhLf7mIz668XJN2vZwZcGITYsup WTEtit7mR6hCicpd67xJT5Ik/tCpnDhtgW2qbq1LA07CFQrZdY9TsULR11AlC/cZn1ro 5HcnIjFGWH3SD4WwlI0RqkiNKJ7JBoIxDOrlsZWM0xgHaAt5vCka8aK+bXfAbodxGi6l 4zpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=K2vg7bjO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j6-20020a05640211c600b00499c424f683si293235edw.223.2023.02.02.11.35.23; Thu, 02 Feb 2023 11:35:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=K2vg7bjO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233171AbjBBTW3 (ORCPT + 99 others); Thu, 2 Feb 2023 14:22:29 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232098AbjBBTW1 (ORCPT ); Thu, 2 Feb 2023 14:22:27 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4BBC6CC81 for ; Thu, 2 Feb 2023 11:22:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675365746; x=1706901746; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=gRLGqnN3dpJh//qUZZcTgNIxIr+Rtxi8TeIn3MqJXDM=; b=K2vg7bjOnCO7BjPz0Vz1ZZaJcXd6Mcwm91zGgPKoJ1FgWLAsTwBbJIKS aMaeox55DY2E7ZLg1bqf6LHFo+GmMzKAqL3+NBS5BZHbzi+Hg5KxQVkbp zeBarABbjJxhiJxn6I8tDVKvYkLQVjdGikeM/Ik7RsnlxirPEsQ59Z24A t4fdOhFEi88oeKv13Y7PXKp7SIVjTqTaYXUzT4cQ33wPUjv6wjoGAVlPr +q1/6yIymt9zEEGnfEOfY2buJxbAgJF232E4joMHVAwsJMPuXMxl8UkwB UtC7KlWxXpR0XK9wytWnjodFaz451Tss/EyXEPSaeE0iO88Srr4hEi0b6 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="312194484" X-IronPort-AV: E=Sophos;i="5.97,268,1669104000"; d="scan'208";a="312194484" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2023 11:22:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="697793066" X-IronPort-AV: E=Sophos;i="5.97,268,1669104000"; d="scan'208";a="697793066" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga001.jf.intel.com with ESMTP; 02 Feb 2023 11:22:09 -0800 From: kan.liang@linux.intel.com To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: ak@linux.intel.com, eranian@google.com, irogers@google.com, Kan Liang Subject: [PATCH V3 1/3] perf report: Support Retire Latency Date: Thu, 2 Feb 2023 11:22:07 -0800 Message-Id: <20230202192209.1795329-1-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756749159702550266?= X-GMAIL-MSGID: =?utf-8?q?1756749159702550266?= From: Kan Liang The Retire Latency field is added in the var3_w of the PERF_SAMPLE_WEIGHT_STRUCT. The Retire Latency reports pipeline stall of this instruction compared to the previous instruction in cycles. That's quite useful to display the information with perf mem report. The p_stage_cyc for Power is also from the var3_w. Union the p_stage_cyc and retire_lat to share the code. Implement X86 specific codes to display the X86 specific header. Add a new sort key retire_lat for the Retire Latency. Reviewed-by: Andi Kleen Signed-off-by: Kan Liang --- The kernel patches have been merged. The V3 only includes the perf tool patches. The V2 can be found at https://lore.kernel.org/lkml/20230104201349.1451191-1-kan.liang@linux.intel.com/ No change from V2. tools/perf/Documentation/perf-report.txt | 2 ++ tools/perf/arch/x86/util/event.c | 21 +++++++++++++++++++++ tools/perf/util/sample.h | 5 ++++- tools/perf/util/sort.c | 2 ++ tools/perf/util/sort.h | 2 ++ 5 files changed, 31 insertions(+), 1 deletion(-) diff --git a/tools/perf/Documentation/perf-report.txt b/tools/perf/Documentation/perf-report.txt index 9b0c0dbf9a77..c242e8da6b1a 100644 --- a/tools/perf/Documentation/perf-report.txt +++ b/tools/perf/Documentation/perf-report.txt @@ -115,6 +115,8 @@ OPTIONS - p_stage_cyc: On powerpc, this presents the number of cycles spent in a pipeline stage. And currently supported only on powerpc. - addr: (Full) virtual address of the sampled instruction + - retire_lat: On X86, this reports pipeline stall of this instruction compared + to the previous instruction in cycles. And currently supported only on X86 By default, comm, dso and symbol keys are used. (i.e. --sort comm,dso,symbol) diff --git a/tools/perf/arch/x86/util/event.c b/tools/perf/arch/x86/util/event.c index a3acefe6d0c6..e4288d09f3a0 100644 --- a/tools/perf/arch/x86/util/event.c +++ b/tools/perf/arch/x86/util/event.c @@ -89,6 +89,7 @@ void arch_perf_parse_sample_weight(struct perf_sample *data, else { data->weight = weight.var1_dw; data->ins_lat = weight.var2_w; + data->retire_lat = weight.var3_w; } } @@ -100,5 +101,25 @@ void arch_perf_synthesize_sample_weight(const struct perf_sample *data, if (type & PERF_SAMPLE_WEIGHT_STRUCT) { *array &= 0xffffffff; *array |= ((u64)data->ins_lat << 32); + *array |= ((u64)data->retire_lat << 48); } } + +const char *arch_perf_header_entry(const char *se_header) +{ + if (!strcmp(se_header, "Local Pipeline Stage Cycle")) + return "Local Retire Latency"; + else if (!strcmp(se_header, "Pipeline Stage Cycle")) + return "Retire Latency"; + + return se_header; +} + +int arch_support_sort_key(const char *sort_key) +{ + if (!strcmp(sort_key, "p_stage_cyc")) + return 1; + if (!strcmp(sort_key, "local_p_stage_cyc")) + return 1; + return 0; +} diff --git a/tools/perf/util/sample.h b/tools/perf/util/sample.h index 60ec79d4eea4..33b08e0ac746 100644 --- a/tools/perf/util/sample.h +++ b/tools/perf/util/sample.h @@ -92,7 +92,10 @@ struct perf_sample { u8 cpumode; u16 misc; u16 ins_lat; - u16 p_stage_cyc; + union { + u16 p_stage_cyc; + u16 retire_lat; + }; bool no_hw_idx; /* No hw_idx collected in branch_stack */ char insn[MAX_INSN]; void *raw_data; diff --git a/tools/perf/util/sort.c b/tools/perf/util/sort.c index d7d0f997873a..4a648231fe72 100644 --- a/tools/perf/util/sort.c +++ b/tools/perf/util/sort.c @@ -2133,6 +2133,8 @@ static struct sort_dimension common_sort_dimensions[] = { 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), DIM(SORT_ADDR, "addr", sort_addr), + DIM(SORT_LOCAL_RETIRE_LAT, "local_retire_lat", sort_local_p_stage_cyc), + DIM(SORT_GLOBAL_RETIRE_LAT, "retire_lat", sort_global_p_stage_cyc), }; #undef DIM diff --git a/tools/perf/util/sort.h b/tools/perf/util/sort.h index 921715e6aec4..9a91d0df2833 100644 --- a/tools/perf/util/sort.h +++ b/tools/perf/util/sort.h @@ -237,6 +237,8 @@ enum sort_type { SORT_LOCAL_PIPELINE_STAGE_CYC, SORT_GLOBAL_PIPELINE_STAGE_CYC, SORT_ADDR, + SORT_LOCAL_RETIRE_LAT, + SORT_GLOBAL_RETIRE_LAT, /* branch stack specific sort keys */ __SORT_BRANCH_STACK, From patchwork Thu Feb 2 19:22:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 52154 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp434764wrn; Thu, 2 Feb 2023 11:42:02 -0800 (PST) X-Google-Smtp-Source: AK7set+FHlrKB8ewOtwPskTKQQ5l8V9cMQ9mLDxrqECTqgIDS7Ws8agJGQT+QMWC8TuWPMvACXIu X-Received: by 2002:a17:907:6d89:b0:878:52cd:9006 with SMTP id sb9-20020a1709076d8900b0087852cd9006mr8658940ejc.69.1675366922430; Thu, 02 Feb 2023 11:42:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675366922; cv=none; d=google.com; s=arc-20160816; b=v4DfTPFQbb5uBHn6/Q2KzPFbpWSSjJTjU6H1PmgZwtW8HUAN2MkXpTA/+iNyqsG4XV vVyi4MpLK0kxMt2WR5BupbZ4/YB2/fTmfxuZti+uCEpR32XXJfFEqwNOp/VqndB2gqze Yty2STXeozQCTpkY55z8i0ZmwvgV1RATawABAQUlTyJ4nn0ilhP291n9OxcveFd0JJU1 OFoFqNo2nE2zmRGoPeAEP5cYAVFuZVb+j1NAZF2gRrDglx4EegQbWMAPApR878vsia+d 5x4n7UcaxUt2SUg4I84hYDN4mn1OP4SDhEEB2+REadqBr/TOeTvm+QoNxRWRG5/RSoi+ ngxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=EEGw+awQWl7jZgnqWQUG1Vdeq1k7JQgAZhDUdzRqRho=; b=ZbyklrX4nUkPvjhSCwCT0ElyrfKTfCJjeQSyx5zw0Ja4ZcHsSYIuEsTHN/V/SCv16j F9tRBx6tNh1QRVbGKlp6AiG3zk0JCZ09DgF56k+OlX6Rg+9KCTZZnD/9edKEheRFDFIv Dkar1oH4WFK4wK7jMjqtk3O50bOX+8ti3cD5dnieLwlck7DYb11g3KARdDa+DhxdzoTM waMZelfRZqUHlDNCCyRbMB2tnVJ1RbgrV5aQ+KXUFTKLhvUrDmSC4F/CL5Ndvnu7pOXx 9KcmjhIw7g0mY+ucCr/6b5ICSXSKAbVsfwYNqNRBtJXSf+zrLlELufMnmMQ7C4mRufkD 4bhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AJVY6HJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id up17-20020a170907cc9100b0088f14ed898asi448963ejc.725.2023.02.02.11.41.38; Thu, 02 Feb 2023 11:42:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=AJVY6HJL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233197AbjBBTWb (ORCPT + 99 others); Thu, 2 Feb 2023 14:22:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233185AbjBBTW3 (ORCPT ); Thu, 2 Feb 2023 14:22:29 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAFBE6CCAA for ; Thu, 2 Feb 2023 11:22:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675365747; x=1706901747; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v295qWvEx3Nv9XHY8DcBdTrp9kA8mC30r+JvmTkGgi4=; b=AJVY6HJLj21CIHLt7iILdqF/KKar0fBbvd+t3Z0Nfsw7Cxo3sEZlKwko P9dcoHI+w95XKMCDhbj4P3LfTkwP3CeGFn+Zok22zHy0+C2P/jM2XOsKI 6DFLlkSj7gX+NIVF+6ZM3NdUpXvosgtMhdiSOmv/Qwzprjlze+d5s2uD/ QjSDOYMrDWlp/2t3QYq5+rKnQMyhc7EC3gksNLwjeGYP+RheENebwmJ7E C8AizMsoP3YhBeWzZh97v3Bu9WacoDaOXVaOGPMB2DDg+cqExxTah5Ddu SxLjuKPIrIQviQQ5yQYahrTFh69aHl0AKo1c/rb1rY3bcjKo1N83PyPEF w==; X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="312194496" X-IronPort-AV: E=Sophos;i="5.97,268,1669104000"; d="scan'208";a="312194496" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2023 11:22:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="697793086" X-IronPort-AV: E=Sophos;i="5.97,268,1669104000"; d="scan'208";a="697793086" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga001.jf.intel.com with ESMTP; 02 Feb 2023 11:22:11 -0800 From: kan.liang@linux.intel.com To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: ak@linux.intel.com, eranian@google.com, irogers@google.com, Kan Liang Subject: [PATCH V3 2/3] perf script: Support Retire Latency Date: Thu, 2 Feb 2023 11:22:08 -0800 Message-Id: <20230202192209.1795329-2-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230202192209.1795329-1-kan.liang@linux.intel.com> References: <20230202192209.1795329-1-kan.liang@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756749546164206947?= X-GMAIL-MSGID: =?utf-8?q?1756749546164206947?= From: Kan Liang The Retire Latency field is added in the var3_w of the PERF_SAMPLE_WEIGHT_STRUCT. The Retire Latency reports the number of elapsed core clocks between the retirement of the instruction indicated by the Instruction Pointer field of the PEBS record and the retirement of the prior instruction. That's quite useful to display the information with perf script. Add a new field retire_lat for the Retire Latency information. Reviewed-by: Andi Kleen Signed-off-by: Kan Liang --- Change from V2 - Rebase on top of tmp.perf/core - Update perf-script.txt tools/perf/Documentation/perf-script.txt | 2 +- tools/perf/builtin-script.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/tools/perf/Documentation/perf-script.txt b/tools/perf/Documentation/perf-script.txt index a2ebadc9d948..777a0d8ba7d1 100644 --- a/tools/perf/Documentation/perf-script.txt +++ b/tools/perf/Documentation/perf-script.txt @@ -134,7 +134,7 @@ OPTIONS srcline, period, iregs, uregs, brstack, brstacksym, flags, bpf-output, brstackinsn, brstackinsnlen, brstackoff, callindent, insn, insnlen, synth, phys_addr, metric, misc, srccode, ipc, data_page_size, code_page_size, ins_lat, - machine_pid, vcpu, cgroup. + machine_pid, vcpu, cgroup, retire_lat. Field list can be prepended with the type, trace, sw or hw, to indicate to which event type the field list applies. e.g., -F sw:comm,tid,time,ip,sym and -F trace:time,cpu,trace diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index cb6b34da4eef..3fe9b1c4caaf 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c @@ -132,6 +132,7 @@ enum perf_output_field { PERF_OUTPUT_MACHINE_PID = 1ULL << 37, PERF_OUTPUT_VCPU = 1ULL << 38, PERF_OUTPUT_CGROUP = 1ULL << 39, + PERF_OUTPUT_RETIRE_LAT = 1ULL << 40, }; struct perf_script { @@ -203,6 +204,7 @@ struct output_option { {.str = "machine_pid", .field = PERF_OUTPUT_MACHINE_PID}, {.str = "vcpu", .field = PERF_OUTPUT_VCPU}, {.str = "cgroup", .field = PERF_OUTPUT_CGROUP}, + {.str = "retire_lat", .field = PERF_OUTPUT_RETIRE_LAT}, }; enum { @@ -278,7 +280,7 @@ static struct { PERF_OUTPUT_ADDR | PERF_OUTPUT_DATA_SRC | PERF_OUTPUT_WEIGHT | PERF_OUTPUT_PHYS_ADDR | PERF_OUTPUT_DATA_PAGE_SIZE | PERF_OUTPUT_CODE_PAGE_SIZE | - PERF_OUTPUT_INS_LAT, + PERF_OUTPUT_INS_LAT | PERF_OUTPUT_RETIRE_LAT, .invalid_fields = PERF_OUTPUT_TRACE | PERF_OUTPUT_BPF_OUTPUT, }, @@ -551,6 +553,10 @@ static int evsel__check_attr(struct evsel *evsel, struct perf_session *session) return -EINVAL; } + if (PRINT_FIELD(RETIRE_LAT) && + evsel__check_stype(evsel, PERF_SAMPLE_WEIGHT_STRUCT, "WEIGHT_STRUCT", PERF_OUTPUT_RETIRE_LAT)) + return -EINVAL; + return 0; } @@ -2187,6 +2193,9 @@ static void process_event(struct perf_script *script, if (PRINT_FIELD(INS_LAT)) fprintf(fp, "%16" PRIu16, sample->ins_lat); + if (PRINT_FIELD(RETIRE_LAT)) + fprintf(fp, "%16" PRIu16, sample->retire_lat); + if (PRINT_FIELD(IP)) { struct callchain_cursor *cursor = NULL; @@ -3876,7 +3885,7 @@ int cmd_script(int argc, const char **argv) "brstacksym,flags,data_src,weight,bpf-output,brstackinsn," "brstackinsnlen,brstackoff,callindent,insn,insnlen,synth," "phys_addr,metric,misc,srccode,ipc,tod,data_page_size," - "code_page_size,ins_lat,machine_pid,vcpu,cgroup", + "code_page_size,ins_lat,machine_pid,vcpu,cgroup,retire_lat", parse_output_fields), OPT_BOOLEAN('a', "all-cpus", &system_wide, "system-wide collection from all CPUs"), From patchwork Thu Feb 2 19:22:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Liang, Kan" X-Patchwork-Id: 52155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp435399wrn; Thu, 2 Feb 2023 11:43:29 -0800 (PST) X-Google-Smtp-Source: AK7set+EP/6bsc8Gz20bc8GyrxVffVZpf63Sq6c/6TxTeuDhqB3Ih/qUm1PSmLwdmV9w5JfWjZ4Q X-Received: by 2002:a17:90a:1b:b0:229:6b20:2424 with SMTP id 27-20020a17090a001b00b002296b202424mr2798736pja.11.1675367009134; Thu, 02 Feb 2023 11:43:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675367009; cv=none; d=google.com; s=arc-20160816; b=Qu/mWM64Hgc7BAnnLv4DUy4dBOHRrDvoo/VO+xoqDj+MPbdTRyZwXeGV7B/gXyCB7E EibjBacGJ+/p96ErTaENUT5aGUU+GMZ8aG0P/FUR/IRrnHMSKvvfuYtLFwYWR7Qtme1Y 3uhGoup2Q9eloMl1YujzsUcO8zVfVHyd5izx/u0hzFy5ObOdCkJQaBmumaFKGSEfRISh s/KleyXTuQvotmw0FCtwvnvt/LjHEy3cc3PgcjqXYygU/GpOuJ5ZK8vxJztAWojQQ7RF E/WOlDZ2KMlFkEbcr1ypIQg1eGHdHYURk/H2HK2PDT1SkQawfmpCjF5pNjimLjXd9GjX guVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=akoZIe/8G4LW06a6wdCffpcDww/AhLeajnse601TWcI=; b=EqDI+yUdlkaUnVgNhFO38GyfuZ5D7ZSkDlZVgB1InW7On5KLwlR8jZvh4/hd9bD4hU n/6N3h+fd1XxPataW5KklWChOwvz4Nf6IFsKCAqn9StaweqLNIvURQPPu6tTuRUZBs3O VaJAe1wGmESxV+TXafw2jcVcSsTbNmyWTMVFgP5weeXm9Imsh4yoBgNvE5pq2cFm4UCb vhhJmwEHtNRd3MahHpYoJl8/lxn7yIr2lX9hZSAjfJiknhqfUW3AW/pION7ZcJvIvA/P lb/d3jbuIlL2G54O8yybxEZ2Nw5/atfpjIsccPfpN5PCRJW8wquMj5qqoCHTv1WjjuEg taOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZoiXQgG7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m25-20020a637119000000b004f143cb44a4si363395pgc.665.2023.02.02.11.43.16; Thu, 02 Feb 2023 11:43:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=ZoiXQgG7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233202AbjBBTWe (ORCPT + 99 others); Thu, 2 Feb 2023 14:22:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233186AbjBBTW3 (ORCPT ); Thu, 2 Feb 2023 14:22:29 -0500 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2865D6CC81 for ; Thu, 2 Feb 2023 11:22:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675365748; x=1706901748; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lPyKGu2uUaNniUnGihB+wDhMHYuNOTEsrZFp5sO3W68=; b=ZoiXQgG78h1udkZcJWv1tRYFXRrLCXVPu3AeOUpu3SW5LVulgxZBvdgn 20xkrDcpjb8uI0hpXZ0dyNbmzGrYIq2RqddsqqywXcAAbWsGCpkMmFJ8K 5yERQB7QW0W4hAUXGT20kbL0ZTyGYs9pQ8clbU0+UAqd5YfxiF2NKF9Ma 6LFXDcKO/4JRrvVla7bz0Dbcm+yNXeJNIwnXm8Ohz6ByrPBqKnuSrOB77 m9LTHGtjAwOqjMFvLzOZMRzmoMAqj16bUjk/zawDQU83MntLnjqQ4SIDp iips7ZVzTkhW3aUfiS+ZZxxW3/DmaHNNv+ixmW17wPx3zPrS4Eot1RKrZ g==; X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="312194503" X-IronPort-AV: E=Sophos;i="5.97,268,1669104000"; d="scan'208";a="312194503" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Feb 2023 11:22:13 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10609"; a="697793110" X-IronPort-AV: E=Sophos;i="5.97,268,1669104000"; d="scan'208";a="697793110" Received: from kanliang-dev.jf.intel.com ([10.165.154.102]) by orsmga001.jf.intel.com with ESMTP; 02 Feb 2023 11:22:13 -0800 From: kan.liang@linux.intel.com To: acme@kernel.org, peterz@infradead.org, mingo@redhat.com, linux-kernel@vger.kernel.org Cc: ak@linux.intel.com, eranian@google.com, irogers@google.com, Kan Liang Subject: [PATCH V3 3/3] perf test: Support the retire_lat check Date: Thu, 2 Feb 2023 11:22:09 -0800 Message-Id: <20230202192209.1795329-3-kan.liang@linux.intel.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20230202192209.1795329-1-kan.liang@linux.intel.com> References: <20230202192209.1795329-1-kan.liang@linux.intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756749636717157401?= X-GMAIL-MSGID: =?utf-8?q?1756749636717157401?= From: Kan Liang Add test for the new field for Retire Latency in the X86 specific test. Signed-off-by: Kan Liang --- New patch since V2 tools/perf/arch/x86/tests/sample-parsing.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/perf/arch/x86/tests/sample-parsing.c b/tools/perf/arch/x86/tests/sample-parsing.c index 690c7c07e90d..a061e8619267 100644 --- a/tools/perf/arch/x86/tests/sample-parsing.c +++ b/tools/perf/arch/x86/tests/sample-parsing.c @@ -27,8 +27,10 @@ static bool samples_same(const struct perf_sample *s1, const struct perf_sample *s2, u64 type) { - if (type & PERF_SAMPLE_WEIGHT_STRUCT) + if (type & PERF_SAMPLE_WEIGHT_STRUCT) { COMP(ins_lat); + COMP(retire_lat); + } return true; } @@ -48,6 +50,7 @@ static int do_test(u64 sample_type) struct perf_sample sample = { .weight = 101, .ins_lat = 102, + .retire_lat = 103, }; struct perf_sample sample_out; size_t i, sz, bufsz;