From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (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 42AF62DCF45 for ; Mon, 15 Jun 2026 00:28:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781483333; cv=none; b=ZefD7zk6eJC3dvskYewGyxdTuS6JTHy6uw7HgcA7erRBgArpLJvihRdfFseQQpJ0qNzzwYC47ISAlipzg9P4ht1cp2FUgCB7SBVZei/26SAVfuv6cZL3lc6ksmANsncVOml6GsN2rBb9NtVacLO7zwpKZXIAbMku0+lWSchVi+A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781483333; c=relaxed/simple; bh=fCVlpXL2uGazK6hnP6cc3BWrJaUKO5XLFx3mFaWWVvc=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=kAtnxz0r8F99Pe4Gc6zxKT8LVWr4uqALw+C5ez1eszSRvTUKXlT7SaYMbB+8pz3Fj337DMpN1gSIsTUqh3ug/B1xupYdFpDiAZ/P5oSF6n+gT7U9LZuwbrr6admCD9no3rNGPXCLQXwXwF5UAvuX1xsOMk3DzrG46L6+R6VvpE8= 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=RclbfHz1; arc=none smtp.client-ip=74.125.82.73 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="RclbfHz1" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-1384427c3efso9538067c88.0 for ; Sun, 14 Jun 2026 17:28:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781483331; x=1782088131; 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=v4xNHmqv7zFUKlku4dHqHUa2aWG7dWgjw71nbHE+d6w=; b=RclbfHz12t/L41yBCz955aTso8s4b59RKGRkA4Uifl366apShUiU+ViBcJD0FNy2jH LhgryYYdxqvXngIo1uOd9rpsdcL1gdF8A2WzRSMS8zkWHBZ9uYaGohtRu5Rmij/JQBEd RFHf9zPhE4A0oeuZhTjAWEvO1TKjjSOrSkXnFGbIYl+L5bTpZGPb9NaiNtBJmcnOr/Qp NZyNqUm2OFcrmNSVT+DSWVlVcbhtkwD6Qz/Tm61uuTFlohVBRPcFXVIld3P6aqjPJbob ic/3TaZK0h7SWsTllkfT4+8SlKIxz+RIUMwrefgO81WxIQwRLksEC0pTpZSePhC0jBjX VLDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781483331; x=1782088131; 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=v4xNHmqv7zFUKlku4dHqHUa2aWG7dWgjw71nbHE+d6w=; b=PmljBSxREPI1GoKGuCIspZvxdQPuUpE6HxXzHww5CPgyyKeF/XnDZaHK1jYQHw2zMq DyLo84fs91FXOv94EOgLebCWk66VOc07MAiu15P61V+r+Tlk0AlgATWhyGAkdJ7PhmeP oElqsjJfPaOFcaTUgha7GELT86ithqqEAWt2NN5ApbhvkFDM2LC62LE/1HH53Q7byR7O pChrr713nxcMFwxGR+WEahOqym5llMM/Camfqf6TRp8gumU+0wKyPov7Zrn2qq2/Bv7C hlXqnb45ABcn7LsEZ5V3DMdAfnci9mRxV4iKxEGWoD4DW2WazwZfwBnNg1Db59o47wKs 81JA== X-Forwarded-Encrypted: i=1; AFNElJ8NT2OANZVNvcUqev9E3YxpNTXlHD7+oNhdC7Cw/diRPi+ENT3M64aNjzEMV9U7yzfxhq20ZsHfqVN99QA=@vger.kernel.org X-Gm-Message-State: AOJu0YyrhVQ2T4Pq5Qv0vsWtv10f4++W0cF6EF7L7tb0X4G5T3Qxjcpy 7yo8ADUEFyFMxICMAjcBNT14pmCpwj2PQ5YojUBkS1WIQEl70gF66ovgsAN2GPCdzEFKU+WOl// +73EMHqXwfA== X-Received: from dycsb5.prod.google.com ([2002:a05:693c:3005:b0:304:dfee:3633]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7300:5412:b0:302:e560:afb5 with SMTP id 5a478bee46e88-3082009d0a3mr7082856eec.18.1781483331194; Sun, 14 Jun 2026 17:28:51 -0700 (PDT) Date: Sun, 14 Jun 2026 17:28:09 -0700 In-Reply-To: <20260615002812.2234795-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: <20260613071100.1508192-1-irogers@google.com> <20260615002812.2234795-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260615002812.2234795-18-irogers@google.com> Subject: [PATCH v18 17/20] 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 83ff8e8002f1..a5045e40a621 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" @@ -3985,7 +3986,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