Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp4794149pxb; Wed, 20 Apr 2022 10:08:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9O97ALHe71qlHqgD3jRMk/w+V7s5P+ySx0n5lNuH2AIN4RVNT4PuQk7t2dlm52RxJmjup X-Received: by 2002:a05:6a00:10cc:b0:506:e0:d6c3 with SMTP id d12-20020a056a0010cc00b0050600e0d6c3mr24397095pfu.33.1650474496563; Wed, 20 Apr 2022 10:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650474496; cv=none; d=google.com; s=arc-20160816; b=uSdgwPNBcaoe/32CT3o4w2cueKJ/O0Q7Nhh59BBx4rAnquQqV2iLFCaIF3xf79vkLp 5lh63hKxB/XjWcXaqUwjDcwraq9fO4UTzDVJRPCtkjpl3Md61nyFrgWNK0LkDXZR6j6H wA1qr/rb8HAKUiCA3nc/w8Rn4ELRJTYB8LoT5xuDrzsHVp/MhBwm1zuB+VrkS4EdGZNk J9S2loR6I8DzJig0Sv/gRoAIEKP2jJ0rwBrgYwtRrBwpt7iM5wUSpBODtNUhx2LXzISf v7fHuUTHHPUe80+iC3lqGSuY9Ivl4hiFPmHJ73bMpPTdlzOCUFQV4lbpVSI3+9ZwgXS2 V3lA== 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; bh=bBD1sSdPtOmqYhIxW2dBOIvw9BDXHDAkBodbywrnvNM=; b=ylNKflB5OXGai7qKbu6/0My29J+t2hZi+fHhDZiL/fWzZfcxpNXqr8ozJB3wR/jP5j tT/O+HrepOYOHOSrIRf8nEyX74mdC7Z4vhTIBrmYUUbgmec3cBaJeJD61hKU83xaoDMZ U2osVJbHxkSQ6qB8m5YYth0Y1WOc9+H1ocDQQttftW4oAN3Iv9km6C2yhD3o3gLxXr9X ZDRnhhpGlOdJ/TQ2zcy/u5NtgerIAIvc1sO4KVrdt3C9E1BaycRpbO1vtrFdcEbczmy0 4ITFhAjpshWogEYVWEGRjWXuk81a4JGyRE/lFmZwDgmL37fSDfBsDpcmh71ZQn8MKRiY rgkQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t14-20020a63b70e000000b00382918eae51si2987029pgf.290.2022.04.20.10.07.59; Wed, 20 Apr 2022 10:08:16 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359768AbiDTK1R (ORCPT + 99 others); Wed, 20 Apr 2022 06:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235601AbiDTK1Q (ORCPT ); Wed, 20 Apr 2022 06:27:16 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C693F329 for ; Wed, 20 Apr 2022 03:24:29 -0700 (PDT) Received: (qmail 15605 invoked by uid 989); 20 Apr 2022 10:24:26 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: linux-perf-users@vger.kernel.org Cc: Ian Rogers , Xing Zhengjun , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo Subject: [PATCHSET v4 next 0/3] perf stat: add user_time and system_time tool events Date: Wed, 20 Apr 2022 12:23:51 +0200 Message-Id: <20220420102354.468173-1-florian.fischer@muhq.space> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Bar: + X-Rspamd-Report: R_MISSING_CHARSET(0.5) MIME_GOOD(-0.1) MID_CONTAINS_FROM(1) BAYES_HAM(-0.151335) X-Rspamd-Score: 1.248664 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 20 Apr 2022 12:24:26 +0200 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FROM_SUSPICIOUS_NTLD, FROM_SUSPICIOUS_NTLD_FP,MSGID_FROM_MTA_HEADER,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=no 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 This patch series adds new internal events to perf stat exposing the times spend in user and kernel mode in nanoseconds reported by rusage. During some benchmarking using perf it bothered me that I could not easily retrieve those times from perf stat when using the machine readable output. But perf definitely knows about those values because in the human readable output they are present. Therefore I exposed the times reported by rusage via the new tool events: user_time and system_time. This allows to retrieved them in machine-readable output: $ ./perf stat -x, -e duration_time,user_time,system_time,cache-misses -- grep -q -r duration_time tools/perf 72134524,ns,duration_time:u,72134524,100.00,, 65225000,ns,user_time:u,65225000,100.00,, 6865000,ns,ssystem_time:u,6865000,100.00,, 38705,,cache-misses:u,71189328,100.00,, The changes are mostly inspired by the code for the only other available tool event: 'duration_time'. For now the new user_time and system_time events are not usable with metrics (as far as I understand). The patch applies cleanly on linux-next/next-20220420. [PATCH v4 1/3] perf stat: introduce stats for the user and system [PATCH v4 2/3] perf stat: add user_time and system_time events [PATCH v4 3/3] perf list: print all available tool events [v2]: Split up the changes into separate commits. [v3]: * Use nanoseconds as suggested by Xing Zhengjun. * Squash [PATCH v2 2/4] and [PATCH v2 4/4], because it only adds the unit string. [v4]: * Simplify event names to only user_time and system_time as suggested by Ian Rogers. Florian Fischer