From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f202.google.com (mail-dy1-f202.google.com [74.125.82.202]) (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 48D523A3E96 for ; Fri, 12 Jun 2026 18:10:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781287843; cv=none; b=rHkGCHJZ7qR1JEx1pqr5Y3bsiR3XmMp7/6vhOglgMtmalmyujbOAm4xCIS9a4Ph8Mr+L3iCmytERUht5pVeRD90gvREWXiUKfabAKo2IlcVatbE6ChhACLRMC78Zo3PnEatDAhzAOwXoQihaEL+lX1XbuLUx5jY3NZ318V12elA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781287843; c=relaxed/simple; bh=GvkEXx+WyoSfBCn3vspChNN7CpfBrp92dgQlAi1nwT8=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=bmfFEviaE3tbPt/BpKc7VQ3EpuQRW34U/n1xknce8xTk3uhQWWbfc3SagAWIejiBL6/1uvDmmYF1AkbvPz26cASVjuDhF8jjNYIYMaT8PeqREGf7oY7YwxfRujRsjVgbbLL4TqkHluMryC3eVzZDVo975e6doJOR7i/HeZl9hmU= 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=IrDs3sX6; arc=none smtp.client-ip=74.125.82.202 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="IrDs3sX6" Received: by mail-dy1-f202.google.com with SMTP id 5a478bee46e88-304c652be4eso1620510eec.1 for ; Fri, 12 Jun 2026 11:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1781287839; x=1781892639; 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=Sd57HX35XTgxJZw6bYHYrXd4/SELuMq6Jv3R/ZZi+hE=; b=IrDs3sX6ZOz+OqtYfpNzddxO0KTFASg2w0iYC2awsPE5MEXdS66mftLvOjvepOID85 jQl1hinJZkVMEbPWY8lYFcB99WMFf6bz3EG0uY37lhaEk+drnLtw0B0eviDEXF4+ROek VjGY1Ge1eUfeuVecjH5j92Lw4GGw0NGnW/k37pmuzBLTvihXCmESgv1beN+COuIwyqA+ OGaIQ2/EiXcOQehJblzbRC+ophUYfGMF3c26YeXba3tfYBUZzuK+ej5+DUlIKG0PIdxk 2DCv0Dw+sd3aXtk8kQiufzdlVOq1+gJYdEyG1ku0oLhMkW40ZeTa6SDZmbpGIDMMDjuc QwzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781287839; x=1781892639; 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=Sd57HX35XTgxJZw6bYHYrXd4/SELuMq6Jv3R/ZZi+hE=; b=ctTGhsgeZOu4L+LwgenLpw7/GyRnJgvL84nUmkmQyJJBDWXGtpUkrN3+Xz/+tfTNMG f7ygptd3SPi1j3KOCZzSRo9jCF1JpCTGVWLSsS3c2I1xg6Zdy/2pZkDlVmj3GmRwCltj yDJzNbas4ZtzLf3Pe5iSe3/RFgYI7aPLSY68WS13pOBRgpnQa068ffGLShqkPq8tQ+ED 0URsiMLImtOte0TAZHhcIsn5Z0CsOn8ZBXL3tN7pzkSuqJVJgl6K6A6dp1kLOl61RSum KX3+o9Fiwx++HykIbv62fohxeQHXJujRSM+e251imKsbyC72I7OufuQdLO55VfzPzaoV apww== X-Forwarded-Encrypted: i=1; AFNElJ/WaKYpczMEwFLowpC4x7BwlS/NmFlKEktlIAIA3j+yhtJxt3Dwzp0EN8QdpyLBoEW62xIqJyGhdwLNsME=@vger.kernel.org X-Gm-Message-State: AOJu0YweFI7UGHVJVlbGNXtiopXl5GCmfpcEWpmQqTqzBFqwtFDYf9ix WHdhHAq7KRhQk4xoTK156FIm4iWwZ3bEd5ASbHsqba2JhE8B7h1dSSRjZdRXtg3XFAfALEs8wed uIenBmiBJDw== X-Received: from dlea1-n1.prod.google.com ([2002:a05:701b:4201:10b0:137:dd82:5b65]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:6095:b0:138:5049:cb88 with SMTP id a92af1059eb24-1385049ccc0mr624385c88.8.1781287839009; Fri, 12 Jun 2026 11:10:39 -0700 (PDT) Date: Fri, 12 Jun 2026 11:09:54 -0700 In-Reply-To: <20260612180956.1105352-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: <20260611224455.201994-1-irogers@google.com> <20260612180956.1105352-1-irogers@google.com> X-Mailer: git-send-email 2.54.0.1136.gdb2ca164c4-goog Message-ID: <20260612180956.1105352-18-irogers@google.com> Subject: [PATCH v14 17/19] 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 dd84fecc8fff..7a53a3c32083 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" @@ -3992,7 +3993,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