From patchwork Tue Jan 23 10:31:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Gainey X-Patchwork-Id: 19311 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2553:b0:103:945f:af90 with SMTP id p19csp241394dyi; Tue, 23 Jan 2024 02:32:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFOrroPlowfl9DS6xBf0kzAk+JxLuc+FZhKXLJMLdQphEzksNLR2yUrP2XzhEHIvK92GgIC X-Received: by 2002:a17:902:c406:b0:1d7:2930:cdaf with SMTP id k6-20020a170902c40600b001d72930cdafmr3531958plk.108.1706005945522; Tue, 23 Jan 2024 02:32:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706005945; cv=pass; d=google.com; s=arc-20160816; b=RTcEHX1o49+FBN1c506SKf8lW7sEXYt+o3dRrCGoT3O6hLkPoC6U48XX/2ZAoaDBpf cMxUsGYTSL3PcvqCI9I4fkiQyMhJWIvfyqmaFTcFgJ/yov19VhQZDi6uOsAWpwhs0Eo6 6zrLMlMV0vMVu+Q2g0cPo/zIl5FsaDU2oJXezfZIg4ofQlNQ0pz8in+btEXwq3tVVr+b Xbs5VMsqBxjo6sQj0U+PP6wAXEhmjxcaizm9ldzQLLiAtPT/Ce8IIIZHxhvb1BVocJCk f8NvIWunMLh9DzZldxWEjCgIryppLy2xpcYzhSbPuYy0DOFKZAF20zWmYsMjd+C1UXKM IydA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=zaMzzPFW7fNNQw4i7yK1z55BqXbxbSFxzqP6whVfzi0=; fh=rTG5NIABeCUS1wWiHAjc60eclX3r/xBdGX1ZVSIbqVA=; b=b2Ew2huNyWyoVWV/XmC/RyDHK/0fR+0mHA4jN+jxKkZzJJvQESnvBE1fJY9ltGrEN0 vIv9jitS0vfwShR9xUywyGgfzB+DvtqoLUMM4QymnbbItFbr6Y9VbfF424tWAzpo50tQ zBkWaupA9lZk/R/fRBpfi4/8fAUMn2xNtOc7YkFGWBt+kmcRwJzRlpkGW6f3MLVaH4T2 heEePdC1ehasbMeLQThCy5R+/TNM1RJYVRFKZSByg9I+DaKs8Mqkq2VoeU49rUkGtp0q SM+p+BtjUVq8h50O01Dgrt8PpXm2GL4y6BfZlO6n50dBV7ZbGX/RIW8S5tHugPKN1bjc 3NJQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-35094-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35094-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id m16-20020a170902db1000b001d757e49a75si2988186plx.478.2024.01.23.02.32.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Jan 2024 02:32:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-35094-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-35094-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-35094-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 8982CB21426 for ; Tue, 23 Jan 2024 10:32:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98EA55C8E5; Tue, 23 Jan 2024 10:32:09 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F40575C5F8; Tue, 23 Jan 2024 10:32:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706005928; cv=none; b=RdNQrP5RKwKOD5AaZ3oAKhZpWvIuildav0+ZVwjyDXdNRRgQOquAhu2PJSGp0NfksTxxMCcY8XZNJMoqC1sCoB/P85/TuRHtlwiymlBuTMIxf9HH/L0V+7u166Huo3oHZyDx7Zp3w4bhMqfGsPj/yExOQ5yJAjDa0HzP3Jfd1p0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706005928; c=relaxed/simple; bh=YGE1daHDtPYZs7zC99WV4cn2vlXjvAdbUjEsLpZJ46U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=LEAsEZPgSu+VmFxZYdrZcPuZBiQRsvmrmD2GyE/yPk7WBIBgJcxepxxvVQV0Ofg7MAmO1egn4Srsl9WWz/V3ccDbum0JYj6qDEs43TI5ILjRNr/JtJNAuhochVr4LVniGPXzseqdxzi6piHSJeKqKmcSXBU5Ex3K6f/haI5bkSM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C656E1FB; Tue, 23 Jan 2024 02:32:50 -0800 (PST) Received: from e126817.. (e126817.cambridge.arm.com [10.2.3.5]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8A1643F5A1; Tue, 23 Jan 2024 02:32:03 -0800 (PST) From: Ben Gainey To: linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, namhyung@kernel.org, irogers@google.com, adrian.hunter@intel.com, will@kernel.org, Ben Gainey Subject: [PATCH 0/1] tools: perf: Expose sample ID / stream ID to python scripts Date: Tue, 23 Jan 2024 10:31:36 +0000 Message-ID: <20240123103137.1890779-1-ben.gainey@arm.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788876890673256589 X-GMAIL-MSGID: 1788876890673256589 This patch modifies the perf python scripting engine so that the ID and STREAM_ID are exposed as part of the sample so that they may be correlated to the corresponding throttle/unthrottle event (for example). NB: For scripts where perf_db_export_mode = True, this may be a breaking change depending on how the script is constructed. Each field is passed to `sample_table` as an argument so any script that is written as: def sample_table(db_id, evsel_id, machine_id, ..., cyc_cnt, flags) will now fail due to the changed number of arguments with: TypeError: sample_table() takes 25 positional arguments but 27 were given Scripts that use: def sample_table(*args) or some variation thereof will not be affected. When `perf_db_export_mode = False`, the script should be unaffected as all the arguments are inserted into a dictionary. The export-to-xxx.py scripts use the (..., *x) form so are not affected. Ben Gainey (1): tools: perf: Expose sample ID / stream ID to python scripts tools/perf/Documentation/perf-script-python.txt | 4 ++-- tools/perf/util/scripting-engines/trace-event-python.c | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-)