Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1532895pxb; Sat, 23 Apr 2022 09:11:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2kmUQPswxYfqclpQ2KwZNrgxFJIN0Ki4iserAxCiXJ3G3fyhN4GLp7C50bH4MXxKC5l5D X-Received: by 2002:a05:6402:254e:b0:424:244:faf with SMTP id l14-20020a056402254e00b0042402440fafmr10787664edb.260.1650730314433; Sat, 23 Apr 2022 09:11:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650730314; cv=none; d=google.com; s=arc-20160816; b=ds5c3MDQHapRw1a8hZKwyjyoF0X9qbhvrWUT83q9gIw3HeX8X09LK+cFaLcq0IUrWg /sGyr30vGATw6GF4OjdlE+0GljgvO4vyKOtvRr60wPWCveD49F+Q4Ic44+tu+0wiMM1I sXtJXm4M2jQb0xVDHnZlOnc1vrhpzBGEtTnf+G7FeRxQaEMGTwyf5X0IfSToOQ/gBtCi dvz7BseLcMZGf93dPbZRrUlL+hx+68BjfDgT9avDCEkwlbIK295bESuRwxyVDrvyh+JX ppsx8wScGsr5+mwk40TjVBBbyedCQhOnXt1hTprFsx21H8FJzai0kXMhz9U9ARMNn9Ex 3uww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=o3WtDsY4eF0OQtukaaIL+WTLBY0FkLTFB3NcSePeJxs=; b=IvsHR0CVIJUmPGwFN3rP944AV9lSbmd1T/F/sx+/S9XEzqi/ttoMut0JlBnLdA0zSH /Gft+coBY5GJrJifSrebrczBRZNR+AGRAS7VsbCuaegboMIzY8Q23DoESdJLBMoxLKkR yY8gBQTxRGZeSuLE6rU2B2ONwb2W23bMOs9XrUEPMfnztc1lDJRyn1wTpnySss6Py3lg Sdgqr0ujDjJu82JUAiMg28H9h9VdpX25WSN+dbHspR3Y0/8MH/7B7vH0FJVxi/snoYCZ I9z4uvArJz4LjokK+nIZrIhpq0iPCoUITilDPVAZUEdjfelMYsXZWQCDwjxX4g+1uaQO 9N1A== 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 m4-20020a056402430400b00423ef8445ccsi9603816edc.16.2022.04.23.09.11.30; Sat, 23 Apr 2022 09:11:54 -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 S235385AbiDWMTJ (ORCPT + 99 others); Sat, 23 Apr 2022 08:19:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234127AbiDWMTI (ORCPT ); Sat, 23 Apr 2022 08:19:08 -0400 Received: from euporie.uberspace.de (euporie.uberspace.de [185.26.156.232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9A257C16A for ; Sat, 23 Apr 2022 05:16:09 -0700 (PDT) Received: (qmail 10142 invoked by uid 989); 23 Apr 2022 12:16:07 -0000 Authentication-Results: euporie.uberspace.de; auth=pass (plain) Date: Sat, 23 Apr 2022 14:15:57 +0200 From: Florian Fischer To: Namhyung Kim Cc: Arnaldo Carvalho de Melo , linux-perf-users , Ian Rogers , Xing Zhengjun , linux-kernel , Peter Zijlstra , Ingo Molnar Subject: Re: [PATCHSET v4 next 0/3] perf stat: add user_time and system_time tool events Message-ID: <20220423121557.z5gzbqadonmrg6ef@pasture> References: <20220420102354.468173-1-florian.fischer@muhq.space> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Bar: / X-Rspamd-Report: MIME_GOOD(-0.1) MID_RHS_NOT_FQDN(0.5) BAYES_HAM(-0.639367) X-Rspamd-Score: -0.239367 Received: from unknown (HELO unkown) (::1) by euporie.uberspace.de (Haraka/2.8.28) with ESMTPSA; Sat, 23 Apr 2022 14:16:07 +0200 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, MSGID_FROM_MTA_HEADER,RCVD_IN_DNSWL_LOW,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 On 22.04.2022 16:52, Namhyung Kim wrote: > Hello, > > On Fri, Apr 22, 2022 at 3:05 PM Arnaldo Carvalho de Melo > wrote: > > > > Em Wed, Apr 20, 2022 at 12:23:51PM +0200, Florian Fischer escreveu: > > > 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,, > > ssystem? Looks like a typo. Yes thanks. Fortunately I fixed it in the commit that got applied [1]. > > Anyway it looks a little bit strange to me if we can get > system time in user mode only (the 'u' modifier). Sorry but I don't really understand what you mean. The system_time is reported to userspace via rusage filled by wait4(2). It will always report the value reported to the user space regardless of what counters perf has access to. If you run perf as user you get the same system_time (but with the ':u' suffix) as when you run perf as root or lower kernel.perf_event_paranoid to allow access to more counters. $ perf stat -x, -e system_time sync 31246000,ns,system_time:u,31246000,100.00,, # perf stat -x, -e system_time sync 33794000,ns,system_time,33794000,100.00,, > > Thanks, > Namhyung > Flo Fischer [1] https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/commit/?h=tmp.perf/core&id=b03b89b350034f220cc24fc77c56990a97a796b2