Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp686287lqa; Sat, 27 Apr 2024 22:36:30 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXctFmgLkSetmACwJ2W6KnRHvYGoxnPZQpjBtfkzdKVKKNZSf+jqfg0p2yxeSlAYjAyBMAnhWKkpTW0370d7pMccK3Ti1GL53/G6DLB6g== X-Google-Smtp-Source: AGHT+IEyCNiZNUhCp0PyRowK9P1ONgFwoGZUuIQp/nvNDSMqtcZiNsQ/ddHgGaKSDuZxt04mBtcd X-Received: by 2002:a05:6214:29ca:b0:6a0:c8c3:7e2e with SMTP id gh10-20020a05621429ca00b006a0c8c37e2emr651243qvb.1.1714282589854; Sat, 27 Apr 2024 22:36:29 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714282589; cv=pass; d=google.com; s=arc-20160816; b=KP+Fgo46gyXeg5aFMs8OXq0Pr4YwKhKQGnHE9DbnvPONuk8nSvx2ZUUwAgpB6iN8rv lmt6Sp11DMpp7kc5HFglAy6j023JSWJKqCG2nLdfWdgY/KTwg31tp61Qg4Cckn1+FKB8 pY7NceddJGDBM0g8pZzRGebJBPwEVjsXsDJYc+O2jOSKoXjTIOoXG3FUMfjLJADwhKea eCItOplPF5pr9EGHy0HhamZbdRA360TQ3ZrE1sptSNuYmiZZNdztYfsyj/4/nAeNimIQ GjOI0PKjr0l03S+OHpTBpCPFSefC0MzmjVclNurOMZ/y87ex7nZPytUvJyIFPElJnChc JVPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:date:dkim-signature; bh=F5UONr62/BtTjFsEWsO6NhiyjPYCMJsSpwuIBi8shds=; fh=ooDPH291ibcGmTNBxdHdgMYEk76f8es7FpyLgd5Re5I=; b=T3+Lk2sWzRaUCTVYEIOE4E2vdtdRCnWMV73Aj90ejs31fhrJOnf/uqYkDbLX2cKAxg W8gb3FeB8blcXbkDHzHKhmDet5zJBWqQq8BRAwpI3LBUjySNeV01xz+K50HTxBYioPAD GFcig04h1qW6xZfyO5Ya3IKwDgRwn2foNmmXl+CPiG7+DAw+Jb/YYbz5VM9f8slN7ylk a+Gd32/61UzqR1B0zJumbV3jO3rtHAw7IOIzNHlgsA+S9TEvoWmILLjfiJ4fm6CMLslb HWvMbbG/nj+SZYbeY2S1Nmq2CubRG4Rl0/ggXEn5oFIHIHONtWYUcTY0+6IYNOoYLMWG 7usA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VjUKM5Rd; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-161262-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161262-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jl15-20020ad45e8f000000b006993eecb931si24407203qvb.601.2024.04.27.22.36.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 22:36:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-161262-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VjUKM5Rd; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-161262-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-161262-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6AFA81C20CD6 for ; Sun, 28 Apr 2024 05:36:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A60276FCB; Sun, 28 Apr 2024 05:36:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VjUKM5Rd" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B81633DF for ; Sun, 28 Apr 2024 05:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714282582; cv=none; b=DtC6lD/ccbmJm2YBYdfjs/5AcqGurlzxYLi7AjyI9LIx6bHa1kqdIVBYVtAd4m2iXRynk5MCmk8d3v1Tyau3z72exmEnoZDDwipBxoLqASPA+KCrv0poWMnBkHEw3ba1dRvy8yDmiwGbG8nX9QjKv9geXaUunpy57bUiP3iZ4AA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714282582; c=relaxed/simple; bh=NFU1j9REnnJnHP9rU0qINEtrlKmkOP2nR4Z7xM3qTzY=; h=Date:Message-Id:Mime-Version:Subject:From:To:Content-Type; b=nmXe55b7uy1QmzrhyAoOrJX/16wCIS7QUenRSCIjM6TYGu2lXL2awi5Xy5DZlwEm7KdsBj6w9AGEG7u7MzigJOMp5geSTu+yNLEckxU5loY8NOnmo82Ui1mQ/R6qZytGsAfjHkNxAazmTJmaUr1GBWIVR9oiZcpETZ525G5cIoo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=VjUKM5Rd; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6b26845cdso5118334276.3 for ; Sat, 27 Apr 2024 22:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1714282580; x=1714887380; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=F5UONr62/BtTjFsEWsO6NhiyjPYCMJsSpwuIBi8shds=; b=VjUKM5RdYC+JuffF5tG5W8bHB4lLYT/GmXOEmbSQL6+RFK6zofN0fgMuBK9Q5nQwYG QFoiXZ3ceBVatJCJ1TC+Mq9BSsoUP8VZQR6nm8evyr4Ip7aLWheWy8y+LnOhQnG3CK3i QO+EtmYnK4UnsoOdPo2QlSobCkaiCOuRMM0O2IvTiPQN5LI5kKdHoYlhHvczk86OVItt V55h7jFDg6djPn+DanMY7l8LPKzAB4Nlg4bE7zkxTe5x60wPCw/XL9jUwoyaJzrXmUts BuHTs2xHMWbT7qC9sJg35bBsgx8uEOYlMbbvHTi5+TYVjKNYABpo0JeSj59XI5+fcTLE 5loQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714282580; x=1714887380; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=F5UONr62/BtTjFsEWsO6NhiyjPYCMJsSpwuIBi8shds=; b=LloLQOvt39sOONvx2FvEbaFKdHCqaMJu3kVkck7sI0V6pHdvcnRQhzWRe2177lrWL1 cGOpLK64r4kyBvf3K0SIDZ0AizYS0BQfOpBQEIDtrbmVlf2GkwbytZ0wY96U6OJqJiDC TDibfvtGOSe3d0VBVBWntPa3bIPGPeNundvBOVXZYLNkHA+7m3kWt650xdnAwAxVQPQF FmGKEi1zTz+iTeKSoaYQS3J8tlfL34cXeBkR9ZUvw/swcrCKWhvrHbg0XehhJ+u3Q0ec QgU/+M4OOvMF74azfqDc82UaQI0l1spxK5MKud/k3EPEB/mF2H2etheMc8yB3z2j0a+S eYdQ== X-Forwarded-Encrypted: i=1; AJvYcCUGNF5WcgYfYB9+nXsaqSC1ZjCzGT3mduwbqB6Bk0TgbRQ8CYUKC8UVCNzfo9SkTTW5lNnAlHKJuD1hDdb7SxDKF3A1SMByu00GBFpn X-Gm-Message-State: AOJu0Yw+757RbsENTJFiFBQFO6r23VcU5G9tUSecct4aB8iJnTdnW7Fa HxATKqL5N3HubJO9Wij8H7axZnFbaceEzjbtm2nAoicwy8p5uEt6MCyZfQPErzd9RWplgGSjXZx /+jDAEw== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:eaaa:2f79:c83c:9def]) (user=irogers job=sendgmr) by 2002:a05:6902:2b03:b0:de4:845b:8f08 with SMTP id fi3-20020a0569022b0300b00de4845b8f08mr2249715ybb.2.1714282580394; Sat, 27 Apr 2024 22:36:20 -0700 (PDT) Date: Sat, 27 Apr 2024 22:36:12 -0700 Message-Id: <20240428053616.1125891-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.769.g3c40516874-goog Subject: [RFC PATCH v2 0/3] Retirement latency perf stat support From: Ian Rogers To: weilin.wang@intel.com, Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Ze Gao , Leo Yan , Ravi Bangoria , Dmitrii Dolgov <9erthalion6@gmail.com>, Song Liu , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Support 'R' as a retirement latency modifier on events. When present the evsel will fork perf record and perf report commands, parsing the perf report output as the count value. The intent is to do something similar to Weilin's series: https://lore.kernel.org/lkml/20240402214436.1409476-1-weilin.wang@intel.com/ While the 'R' and the retirement latency are Intel specific, in the future I can imagine more evsel like commands that require child processes. We can make the logic more generic at that point. The code is untested on hardware that supports retirement latency, and with metrics with retirement latency in them. The record is also of sleep and various things need tweaking but I think v1 is good enough for people to give input. The first patch refactors tool events. I came across various issues while looking into the issue and we can likely just pick it first. I kept it in the series for cleanliness sake. The code has benefitted greatly from Weilin's work and Namhyung's great review input. v2. Better refactor tool events to support interval mode and more. Switch "weight1" to "retire_lat" in perf report command. Ensure max precision 'P' is enabled on the perf record command. Kill the perf record at read but keep sleep 0.1. Fix issues around perf record of tool and retirement latency events. Ian Rogers (3): perf evsel: Refactor tool events perf parse-events: Add a retirement latency modifier perf evsel: Add retirement latency event support tools/perf/builtin-stat.c | 74 +++--- tools/perf/util/evsel.c | 409 ++++++++++++++++++++++++++++++++- tools/perf/util/evsel.h | 10 + tools/perf/util/parse-events.c | 2 + tools/perf/util/parse-events.h | 1 + tools/perf/util/parse-events.l | 3 +- 6 files changed, 453 insertions(+), 46 deletions(-) -- 2.44.0.769.g3c40516874-goog