Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp1043454pxb; Wed, 6 Apr 2022 07:23:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZMk5SxypE8zBe61hfGFz3vvv1L+QKkfVgeu6I/lCShHDTjMI8KrJ5YRWcfcZVGiNoqxWG X-Received: by 2002:a17:902:d4cc:b0:154:3a3b:4172 with SMTP id o12-20020a170902d4cc00b001543a3b4172mr8592229plg.165.1649255003756; Wed, 06 Apr 2022 07:23:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649255003; cv=none; d=google.com; s=arc-20160816; b=XR3A8bIQhvMlInva71yNBSVAsCdC0P2G5sC4gvmuUiYR7VTHs0wp7OiS8aHgcTHtaV SfMb4cZRDmO23HonN3hM1ennDR6JbDQDuHyWJ4APH0DS19CSYKAZbv3cdqad1LoQNl3U L/WdfhUq4egJtETMr4nYuF4RUZ96ABuCE1TfgJkAyIGkzDrtZuDINK9QJ/FPSfADu5Ax rHVeCsfdJxQ9Qkg+hp/C7gp7tKxTZ2S08AF5rg6XAltJjUDUAOGJUUa9OnWmFoMjRtrg Kr5WkX4vNmjsUVU8SuehhelGyYL+M/Ybwc/qupMftdjTOnTJr8gyzN9E7ZT2+VLwyU3J 2pXA== 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; bh=G/fFv4RGFIOt9OFVBFvdMvB8NSp78Jok9aVDxoatcsU=; b=TqXuuaqnXVcBCXkVM7d7JoYkx4rlTlxHjlY1gZnzveA0ItVObsMPZkk2+oZ/OYERUc T8DJcAZx4bbhkYaw9rHja2377vhvGHBZs4fRHpMZI4UiQVkwA/3Pkk3nRW0WqgUL0yRi xQn/fLvxOySoSa6nvsCkExVbUwbq0NVqCsXMw9iOXdq6nCrqRhqis/oJKpl6Id7rKeM+ 4jeTlwsMfPDoQ6pXT6LyIEDE4+CVEU3LiBWiPE2WmoTNj0SkhaBlcRUzhwEsNP8Hu702 vlcdayIGd5CLttSM9/+DX1k2Xxhtq75J7XjnfjiHlvGDSMOXeUQgTtDPJzTI9hEk4dy2 UsEA== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j9-20020a63cf09000000b0038608620a5csi15970056pgg.642.2022.04.06.07.23.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 07:23:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EEC914D23B9; Wed, 6 Apr 2022 05:07:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231831AbiDFL7X (ORCPT + 99 others); Wed, 6 Apr 2022 07:59:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232791AbiDFL6T (ORCPT ); Wed, 6 Apr 2022 07:58:19 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9FA43BE61A for ; Wed, 6 Apr 2022 00:29:05 -0700 (PDT) Received: (qmail 8173 invoked by uid 989); 6 Apr 2022 07:29:03 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: Arnaldo Carvalho de Melo Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Florian Schmaus Subject: [RFC v2] perf stat: add rusage utime and stime events Date: Wed, 6 Apr 2022 09:28:35 +0200 Message-Id: <20220406072839.107519-1-florian.fischer@muhq.space> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: 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.054225) X-Rspamd-Score: 1.345774 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Wed, 06 Apr 2022 09:29:03 +0200 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00,FROM_SUSPICIOUS_NTLD, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 utime and stime reported by rusage. During some benchmarking using perf it bothered me that I could not easily retrieve the times spent in user or kernel mode 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: rusage_user_time, rusage_system_time and their aliases ru_utime and ru_stime. This allows to retrieved them in machine-readable output: $ ./perf stat -x, -e duration_time,ru_utime,ru_stime,cache-misses -- grep -q -r duration_time tools/perf 72134524,ns,duration_time:u,72134524,100.00,, 65225,us,ru_utime:u,65225,100.00,, 6865,us,ru_stime:u,6865,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 rusage_* events are not usable with metrics (as far as I understand). The patch applies cleanly on linux-next/next-20220405. [PATCH v2 1/4] perf stat: introduce stats for the user and system [PATCH v2 2/4] perf stat: add rusage utime and stime events [PATCH v2 3/4] perf list: print all available tool events [PATCH v2 4/4] perf util: add 'us' unit to the rusage time events [v2]: Split up the changes into separate commits. Florian Fischer