From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f201.google.com (mail-dy1-f201.google.com [74.125.82.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 4E7803C0A16 for ; Mon, 15 Jun 2026 22:31:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781562663; cv=none; b=HsALUuv/LIwOgBXOx6zK53ktc2zgwosL0z4ZtTdfoAEiQG12R9wFIqKxAskmXnX36BqWDr6ou+hmGg9z4JuktqNklGdzLulPpo30Xie1ijUqw+aSsmInbq3+FPcbcTKo2Ssuj30z66V/N+gA6kwBBc0sAbf/66cEZWstHydQzas= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781562663; c=relaxed/simple; bh=t/LhJ10u5dl+TczaQe/LZURK3yNFuTaIISU3LK2SOPI=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=WdTjbpP6A2LeyAIJK49PhlaHX8XZ1b78n9jLmVgaICr4SqX9K4KEW6+KbCp5skWZ1coGDutIF0HATAuQW4PRoF0gODv0HvMcfyW6qf/Ej9n5uOLvd6iNp0S7/2DQlneJE7GvR7KaeLsClppd4bL8dksEHt+FLYcVxZs+4I+arnY= 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=PjIc18E3; arc=none smtp.client-ip=74.125.82.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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="PjIc18E3" Received: by mail-dy1-f201.google.com with SMTP id 5a478bee46e88-304ec73b015so1064254eec.1 for ; Mon, 15 Jun 2026 15:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781562661; x=1782167461; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=bAee8Y38VMh4ewZxYIBMES9ciGIaXoibDzamzAZ9gF4=; b=PjIc18E3h7NqBE9OSfSilyMzujlt6ErOi/0ApmR9SBBcaEb9z8qyQm276DAcI8wWmV mFh0eHtC06BoTyn+PEKlBGxlFqB59DXB+RlbTL9KnW1zdezdZM0Us0AC3h9CiIqAvEyY 1IvkJPwsz3koAQAsfjfwiGeQJIVzHsiVydz9tyR3m1nWHucQPVIVM2PN1wetMRBmATwb gY1Hf4HNySRL5AL38szq8mab3LPvClXxhcEHZGOlla7F5yRmT+93IKpSfTdQoV0523vv Mf28cMfIiTZ6kSU6YwfHGqgf4f4HUEHf0ywwBYo+BXUbvk3tBI9J5PkhAuDQQYMLTQKE jpBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781562661; x=1782167461; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bAee8Y38VMh4ewZxYIBMES9ciGIaXoibDzamzAZ9gF4=; b=fwy9ttIigVhBZyOjiGXJIH9eXFoKf2MDG8Sp3G7kwcLJyQiPyzK783rcNOZZzZeEQr 4LI/4NgNmNjEhRFZjS6iboE4SiY686jXjhvZZeClkitqrsTNWdQsm2hw6koQCxM8kNha 5bTtx3pT1ZCSNIFqXQ9SEDiM5pR2UndCSWNWxzIBZXprOlfDdV0EMUhEDq8AQxFCtTTH vvcmXvAX5vosgRJTZj4vF+tokT80Bprq0dZ3DE6u5f/Nepv9geCDDzDckc6qdPNHXEGr ZdjSo4BTwtTgKirdZqfD6Ho+fujuzcSM5FkVq+90CD+DjAs/PjVKmFvGXseBmWdn5ooF LR6w== X-Forwarded-Encrypted: i=1; AFNElJ+dTDrvrKrzEIYw7qYl/9c7zMa5crRH3nlH3NIgeGumx10i3rDcW6DSfUXSsJduAdrunn6U6MJnBiaTq9g=@vger.kernel.org X-Gm-Message-State: AOJu0Yyl0Uzcv3tYiXaR+Q6wOU8axHcULmN3yGxg7Ehtunnp4y1xhLD2 1gUYUL2lGw8VBOJrSHRcgd0cD+CuNZc1ZquP6BV2vSfGP0UJtEilbkfrp0WVbcjiOoBvJQPmbsV f79brOMvK+w== X-Received: from dyw6.prod.google.com ([2002:a05:7300:8806:b0:2f2:fc0:8869]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:e882:b0:304:e2a5:689e with SMTP id 5a478bee46e88-30ba5989923mr678087eec.2.1781562661150; Mon, 15 Jun 2026 15:31:01 -0700 (PDT) Date: Mon, 15 Jun 2026 15:30:07 -0700 In-Reply-To: <20260615223011.3873955-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260615061631.2382079-1-irogers@google.com> <20260615223011.3873955-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260615223011.3873955-18-irogers@google.com> Subject: [PATCH v20 17/21] perf python: Add config file access From: Ian Rogers To: irogers@google.com, acme@kernel.org, namhyung@kernel.org Cc: adrian.hunter@intel.com, alice.mei.rogers@gmail.com, dapeng1.mi@linux.intel.com, james.clark@linaro.org, leo.yan@linux.dev, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, mingo@redhat.com, peterz@infradead.org, tmricht@linux.ibm.com Content-Type: text/plain; charset="UTF-8" Add perf.config_get(name) to expose the perf configuration system. Assisted-by: Gemini:gemini-3.1-pro-preview Signed-off-by: Ian Rogers --- tools/perf/util/python.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index c5f567c15cc7..3a9f4e35d0bb 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -17,6 +17,7 @@ #include "build-id.h" #include "callchain.h" #include "comm.h" +#include "config.h" #include "counts.h" #include "data.h" #include "debug.h" @@ -3993,7 +3994,26 @@ static PyObject *pyrf__syscall_id(PyObject *self, PyObject *args, PyObject *kwar return PyLong_FromLong(id); } +static PyObject *pyrf__config_get(PyObject *self, PyObject *args) +{ + const char *config_name, *val; + + if (!PyArg_ParseTuple(args, "s", &config_name)) + return NULL; + + val = perf_config_get(config_name); + if (!val) + Py_RETURN_NONE; + return PyUnicode_FromString(val); +} + static PyMethodDef perf__methods[] = { + { + .ml_name = "config_get", + .ml_meth = (PyCFunction) pyrf__config_get, + .ml_flags = METH_VARARGS, + .ml_doc = PyDoc_STR("Get a perf config value.") + }, { .ml_name = "metrics", .ml_meth = (PyCFunction) pyrf__metrics, -- 2.54.0.1136.gdb2ca164c4-goog