From nobody Tue Dec 23 12:16:07 2025 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.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 4F47C215782 for ; Thu, 9 Jan 2025 07:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736409101; cv=none; b=r8H+2f4tBB6NQ4XvQtJS1mobnfOVV5r/3hTzqhLMPH5feuUfNNOfSZuS0IvIs1Wwp175eWISyUswyKWIC5spE6W+OMG5S3/rQ6LFy2CliX3MrFPJ7jsFOI19xD/Ff3Zn0HlkoR3JxuiQJ0QUF4I3HgCf6IFKP+7C+AdghfwD2bc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736409101; c=relaxed/simple; bh=406aBAYGFzDV1bL8OXedVAztzJzIPqw3jyxHJV9iafY=; h=Date:In-Reply-To:Message-Id:Mime-Version:References:Subject:From: To:Content-Type; b=twW2r55UOYtd689VY4p/SNTBXTw0yPdtwPPmtGfwY/72vVBWpbHCpLbrFiB7xVbHfWvFGftGfq/PnaEum/gnCcWaJDaTUoCNeJy4LjIqA22wFxmTBoTcTDDvsDBmaRj9w94o4qr5ttj/iHZQ8mWkHllHO5SaSwv2gbLz26GEIik= 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=gKOxsjY3; arc=none smtp.client-ip=209.85.219.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="gKOxsjY3" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e549b6c54a0so1576857276.3 for ; Wed, 08 Jan 2025 23:51:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1736409099; x=1737013899; darn=vger.kernel.org; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=cCiXoa6hR4V0Hw+AXJa/eNgQ4Vri6Ug0YtvV6AM9HlI=; b=gKOxsjY3BQz7mPQozo7ijPkehrao6MuMzdnkxRIO1NnUzMSK5nikTDm3Ov/BMpaJY5 eiLRMMubRQztQ2FVWDdSONnTQAlhDb8VIEc9c0RvAbcA0LjoHp4u9Fvf3iDGRRekhVn6 q0kOQjoKPwb2Sl1Q3AtMjm3ZvKlzNbA9gUl9FAv1vXAog9nL9tJaNonmLERzvFKJ6nFV KhhkO1eCbcTzB9YMWFZ0IGx5wYvc+JrlSqN6ehPQ9CO9r1tMZWgRQd3wefl6D6MGWhCk dqqdWzpjnAwxyvfb1OgSA7aq1UwMGNBnctdcYCIZNUbX7C9CqtVeeXISn8wAEH3PwGLF +mFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736409099; x=1737013899; h=to:from:subject:references:mime-version:message-id:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=cCiXoa6hR4V0Hw+AXJa/eNgQ4Vri6Ug0YtvV6AM9HlI=; b=mOC+q1DXvNLs9GPIjBW+9GQTjgobBKeTwMBhKem9h9EFLw+fwPKN2GEFHWRW18is+V iPMJUBSDJy+e9H2TQnQC1eWG7iLYUBckR8TYq+iNfdyv+ZNLkfyiuXQEUCzvpOCTw9P0 L+qdPbDndtWQj1uUFhJgDGOYdKiPceoQv491mB4xz3ypMnc+yyhFepprb8y2tAH3J0r1 c4Rfi/7evU5jyMVrTF2rS4nmLwPmc3HhDkFPG1ose5zgaoIGPdzdpX/wRdeGBVI3grDM SoICLFrXnLtDolelYL0z2KdRnCwToVNVY+lmHAlZeYmWIfoDXSSOT6T1UQUStNHKWs/T RG0w== X-Forwarded-Encrypted: i=1; AJvYcCWwxWy7hI/MRbV6ksi3ntELpvGZXPGUDbSgy97PtBgqjNRc1VNUf8ysUABNiQXQNi3SlRXsI0bsCAFv25A=@vger.kernel.org X-Gm-Message-State: AOJu0YzEMNzpflWmd9Nv64LKmkNkaD629rXz6lFGjCgqnAh20YO8IcUV UUmmXUIk7djSeG3nrPWEzApIGFBm26GDJDzhNK+8TZaNMQMeV+xrI5Q737JRYzJzuP06MfzBRwo iSUeCYw== X-Google-Smtp-Source: AGHT+IEUKlwAipnWk8Ae+MXLNubrpdFPQ+OhZD+yTJnGFg/lMMxHqtycrS4GlaxwkuwxAUkdpNQSkeuw8Qk5 X-Received: from irogers.svl.corp.google.com ([2620:15c:2c5:11:f801:f788:c7e5:c181]) (user=irogers job=sendgmr) by 2002:a25:2782:0:b0:e3c:9fb5:3933 with SMTP id 3f1490d57ef6-e54efa4e3b4mr11130276.9.1736409099307; Wed, 08 Jan 2025 23:51:39 -0800 (PST) Date: Wed, 8 Jan 2025 23:51:07 -0800 In-Reply-To: <20250109075108.7651-1-irogers@google.com> Message-Id: <20250109075108.7651-11-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20250109075108.7651-1-irogers@google.com> X-Mailer: git-send-email 2.47.1.613.gc27f4b7a9f-goog Subject: [PATCH v1 10/11] perf python: Add evlist.config to set up record options From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , Yicong Yang , James Clark , Howard Chu , "Dr. David Alan Gilbert" , Levi Yun , Ze Gao , Weilin Wang , Xu Yang , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add access to evlist__config that is used to configure an evlist with record options. Signed-off-by: Ian Rogers --- tools/perf/util/python.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 1e8ab5291637..38a7e16e09c9 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -9,10 +9,12 @@ #include #endif #include +#include "callchain.h" #include "evlist.h" #include "evsel.h" #include "event.h" #include "print_binary.h" +#include "record.h" #include "strbuf.h" #include "thread_map.h" #include "trace-event.h" @@ -1043,6 +1045,31 @@ static PyObject *pyrf_evlist__open(struct pyrf_evlis= t *pevlist, return Py_None; } =20 +static PyObject *pyrf_evlist__config(struct pyrf_evlist *pevlist) +{ + struct record_opts opts =3D { + .sample_time =3D true, + .mmap_pages =3D UINT_MAX, + .user_freq =3D UINT_MAX, + .user_interval =3D ULLONG_MAX, + .freq =3D 4000, + .target =3D { + .uses_mmap =3D true, + .default_per_cpu =3D true, + }, + .nr_threads_synthesize =3D 1, + .ctl_fd =3D -1, + .ctl_fd_ack =3D -1, + .no_buffering =3D true, + .no_inherit =3D true, + }; + struct evlist *evlist =3D &pevlist->evlist; + + evlist__config(evlist, &opts, &callchain_param); + Py_INCREF(Py_None); + return Py_None; +} + static PyObject *pyrf_evlist__disable(struct pyrf_evlist *pevlist) { evlist__disable(&pevlist->evlist); @@ -1100,6 +1127,12 @@ static PyMethodDef pyrf_evlist__methods[] =3D { .ml_flags =3D METH_VARARGS | METH_KEYWORDS, .ml_doc =3D PyDoc_STR("reads an event.") }, + { + .ml_name =3D "config", + .ml_meth =3D (PyCFunction)pyrf_evlist__config, + .ml_flags =3D METH_NOARGS, + .ml_doc =3D PyDoc_STR("Apply default record options to the evlist.") + }, { .ml_name =3D "disable", .ml_meth =3D (PyCFunction)pyrf_evlist__disable, --=20 2.47.1.613.gc27f4b7a9f-goog