From patchwork Wed Jul 19 20:49:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 122838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp2713167vqt; Wed, 19 Jul 2023 14:17:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlHM973VFfL2gmOUFAdw6g/f6S0SOBg0aGBI8PQxgkIAljDYh9fLrC3tDB0ENgv9B/xBPRge X-Received: by 2002:a17:90b:b10:b0:263:72fe:3ef7 with SMTP id bf16-20020a17090b0b1000b0026372fe3ef7mr15789597pjb.42.1689801462985; Wed, 19 Jul 2023 14:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689801462; cv=none; d=google.com; s=arc-20160816; b=J7mrSH5jZvGE5rzRNJ64YMiiyvqMKgRH78cPK2ZJkcEKzdxxbAZhgQAJBrR5ZwWs6z Nyxk70OMN5n+BtjQXlkdfTV5viUUdNrBuwaweygtt4C95Qvt3I7b7dwOEwy1JovrAGvD ulVxuPFenyUqZP+EXw/MRDA62kESt+gzVqRNDGPrZFGWp8wVXPPmSRuT0pS+F/wMNr+v C1FXTaYYPfn7iflU32zGa3CSSoGsvltyxAMIk2pYKCZGMBoa7Sf6TsfuUf2HAGH3WUDq tc7QvtSTQhuySqGwFQk/Ll3+iaBWHOxKYHS23VQOs63SG4B9aC8AvO04xeoR/m7zTaow bvtw== 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=CeTeSvzTZmjJ8PuEZOBwS5Se+Tvb9FHwatF06dFzR8s=; fh=+f/UgXFaEXexPSiEzT8nRacxrlb6xSaAhUFMhN/xNro=; b=jHAq++c1P6KzCSKgcREzmXb4xYDeb+jCaRBTP3hs2MCaNnZtnfdfsARmzFL/Sbed+9 w3tukcL2tKTQ5d8us+yaRmHUNTci1/cL68Mevdb22vIkKY3+cf6gBLIVugwRdgglZW2l 6rDo9OYuVCw8es93qy++esOC86AN/6N6ttUSZ1ANEcU2gqsfrJiuJHWV1LiFSTlLxXRh UwBfyNJrOkAlCaQXO5/UcqcNQYjnFPHGTpnto4vj2ttHVZbmw3a2g2lbvx6uT/lCpTNm DqV+Be7LKgBETw3XwV7eIR3y+T7kJJw43xaptE0g0M4XU6s4MrS54Yk9RRu0xQ7YziE7 wrMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BpQv1z4I; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 1-20020a17090a0b8100b00263e5a7d8d7si2112934pjr.1.2023.07.19.14.17.30; Wed, 19 Jul 2023 14:17:42 -0700 (PDT) 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=@kernel.org header.s=k20201202 header.b=BpQv1z4I; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230232AbjGSUtp (ORCPT + 99 others); Wed, 19 Jul 2023 16:49:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231167AbjGSUti (ORCPT ); Wed, 19 Jul 2023 16:49:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348AA2110; Wed, 19 Jul 2023 13:49:36 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 80C14617D6; Wed, 19 Jul 2023 20:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AADD4C433C8; Wed, 19 Jul 2023 20:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689799774; bh=TSAUEsjKipWRQRCBkVitDwEGleao6uFXPDlBRtKZDMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BpQv1z4IO7BiRIUvVWopfhw3MykuFZpy3RXqTvmrt7KISq9+8J4SU5/PmtjFvUJuS OtstdL3dcbNi4uW1/Ol+zhIJ4DAxjmPTRtHZNCqtlmi1PXEMxJv3cnRBrnXua5+DzX Xo19PPG66VTGCv3+V6tX9esKr2qEd0wG2Xy/216H7vXKOKRjBkJOIVeZom7T5cquPb 1wH1awSkRnN2LDamE1Ma4+ZBNXcLBddmSQWF3w7Ut6vYHYb1cGHJZWUV3tYeIir7X6 49ZemQSPku2IYoHz/RvGZhT0El8eFlUtPT1R2IG5f8hkdOSdU2OujZyh9qXyHFKc2L 9f0TbJRReTKvQ== From: Arnaldo Carvalho de Melo To: Namhyung Kim Cc: Ingo Molnar , Thomas Gleixner , Jiri Olsa , Ian Rogers , Adrian Hunter , Clark Williams , Kate Carcia , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Arnaldo Carvalho de Melo , Andre Fredette , Dave Tucker , Derek Barbosa , Masami Hiramatsu Subject: [PATCH 3/5] perf bench uprobe: Show diff to previous Date: Wed, 19 Jul 2023 17:49:08 -0300 Message-ID: <20230719204910.539044-4-acme@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230719204910.539044-1-acme@kernel.org> References: <20230719204910.539044-1-acme@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1771885258721290376 X-GMAIL-MSGID: 1771885258721290376 From: Arnaldo Carvalho de Melo Will be useful to show the incremental overhead as we do more stuff in the BPF program attached to the uprobes. Cc: Adrian Hunter Cc: Andre Fredette Cc: Clark Williams Cc: Dave Tucker Cc: Derek Barbosa Cc: Ian Rogers Cc: Jiri Olsa Cc: Masami Hiramatsu (Google) Cc: Namhyung Kim Signed-off-by: Arnaldo Carvalho de Melo Reviewed-by: Masami Hiramatsu (Google) --- tools/perf/bench/uprobe.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/tools/perf/bench/uprobe.c b/tools/perf/bench/uprobe.c index 60e7c43298d8cf56..a90e09f791c540a9 100644 --- a/tools/perf/bench/uprobe.c +++ b/tools/perf/bench/uprobe.c @@ -36,24 +36,35 @@ static const char * const bench_uprobe_usage[] = { static int bench_uprobe_format__default_fprintf(const char *name, const char *unit, u64 diff, FILE *fp) { - static u64 baseline; - s64 diff_to_baseline = diff - baseline; + static u64 baseline, previous; + s64 diff_to_baseline = diff - baseline, + diff_to_previous = diff - previous; int printed = fprintf(fp, "# Executed %'d %s calls\n", loops, name); printed += fprintf(fp, " %14s: %'" PRIu64 " %ss", "Total time", diff, unit); - if (baseline) + if (baseline) { printed += fprintf(fp, " %s%'" PRId64 " to baseline", diff_to_baseline > 0 ? "+" : "", diff_to_baseline); + if (previous != baseline) + fprintf(stdout, " %s%'" PRId64 " to previous", diff_to_previous > 0 ? "+" : "", diff_to_previous); + } + printed += fprintf(fp, "\n\n %'.3f %ss/op", (double)diff / (double)loops, unit); - if (baseline) + if (baseline) { printed += fprintf(fp, " %'.3f %ss/op to baseline", (double)diff_to_baseline / (double)loops, unit); - else + + if (previous != baseline) + printed += fprintf(fp, " %'.3f %ss/op to previous", (double)diff_to_previous / (double)loops, unit); + } else { baseline = diff; + } fputc('\n', fp); + previous = diff; + return printed + 1; }