Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp934345pxb; Wed, 6 Apr 2022 04:44:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1oO11/NZuCXh5jMfEmBdM5KZxy05/JwH84XxWktMm7MMkcTzPTenLgdBS/gkdm+hWfqDd X-Received: by 2002:a63:6e48:0:b0:397:fb23:794f with SMTP id j69-20020a636e48000000b00397fb23794fmr6778781pgc.338.1649245459948; Wed, 06 Apr 2022 04:44:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649245459; cv=none; d=google.com; s=arc-20160816; b=QPSF8UIkXf/fkBAScOre77mszFf8f9JVFf/l5dq6AyZ1mbcVvl2jevm4sy2XTb0DL1 fEKHYxR3XQhOlrPMn80Gq0h64mCFzO3SLQUKRmtOttUiagViQw8XRWEPngQfWfHBde5c 9psQJc/CQn7UKnaKDklxFyDq1jG8dfKf5PnUpDC9UJl4FPPw+O9Gs3fmh2VQ2AWwC8ez GB4n7GxDasYQZMvDTUqOqtkQPYB6RAMMBqB51xbujxfhhdhNsrqWfs76I2JOgjvctC1H xuZEVFdDr/SWLdc2A9SwKlkmtvQ49jLOoD2R3hsEtut+X2FyobOnri59A+khGWXooE+z RDJg== 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=jK0YIFsWFt5S76oJ3EKP4/WDZOZl5U27a7cXqMMnbdM=; b=JHqmvLqwAdfqF8ACOwmZ48s6Jk5gBL/Ct/RJyc0uLg3QBXHDLbv1T71FqFZq6BXequ 0EJ1yovPek3sgpYKcGjZ+tEaiT2/GzD9vGaEhOJsvBZsOAkAXq9QFdcMODR0hU1ljuk2 azbfGEGukpAwSG+oIF1gygWRk2YYYXd8YrvsFMv/LhNbD8mocYwQ4hjcDHiRPO44wxj7 10mMRMv1bSroWADI75qKAV8A5plwXV/Sd5miGWAGvk2B+GnDPI9mweLdHYoP3F4ZhLCX JifL3t7j/Omn2ux9GuJs1Xo6tXj3GH/KFdB+P0FJfY2XK+nPhgcBrtM0upoNJ+BciSYi vMdQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id i194-20020a6287cb000000b004fa3a8dffe4si15330735pfe.155.2022.04.06.04.44.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 04:44:19 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CECDA399CAB; Wed, 6 Apr 2022 03:01:19 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1838078AbiDFAt7 (ORCPT + 99 others); Tue, 5 Apr 2022 20:49:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573050AbiDERt3 (ORCPT ); Tue, 5 Apr 2022 13:49:29 -0400 X-Greylist: delayed 401 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 05 Apr 2022 10:47:27 PDT Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A435AD1114 for ; Tue, 5 Apr 2022 10:47:26 -0700 (PDT) Received: (qmail 18699 invoked by uid 989); 5 Apr 2022 17:40:44 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) From: Florian Fischer To: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Florian Schmaus Subject: [RFC] perf stat: add rusage utime and stime events Date: Tue, 5 Apr 2022 19:40:27 +0200 Message-Id: <20220405174028.1675025-1-florian.fischer@muhq.space> X-Mailer: git-send-email 2.35.1 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.066982) X-Rspamd-Score: 1.333017 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Tue, 05 Apr 2022 19:40:44 +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 Hallo everyone, this is my first time sending out patches to the linux kernel repo so I am not really confident in doing the correct thing. This patch adds new internal events to perf stat exposing the ru_utime and ru_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 and rusage_system_time. tools/perf/builtin-stat.c | 41 ++++++++++++++++++++++++++++++++--------- tools/perf/util/evsel.c | 19 ++++++++++++------- tools/perf/util/evsel.h | 4 ++++ tools/perf/util/parse-events.c | 44 ++++++++++++++++++++++++++++++++++++++------ tools/perf/util/parse-events.l | 2 ++ tools/perf/util/stat-shadow.c | 2 ++ tools/perf/util/stat.h | 19 +++++++++++++++++++ 7 files changed, 109 insertions(+), 22 deletions(-) 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. And I send this emails to anyone mentioned in the MAINTAINERS file. Sorry for the possible unnecessary email spam :) Florian Fischer