aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/Makefile.thinlto
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2026-10-02 11:26:12 -0700
committerArnaldo Carvalho de Melo <acme@redhat.com>2026-10-03 11:00:32 +0200
commit2c672ffdad4bc79e49c2187bcbe43a428a440889 (patch)
tree9185c62546c1530f0f8463e924df63da89c157ee /scripts/Makefile.thinlto
parentperf python: Quietly stop processing events when a callback raises (diff)
perf python: Lazily copy events and samples from process_events
When perf.session.process_events() delivers an event to a Python callback, pyrf_event__new() previously copied the raw perf_event into a 4,160-byte union perf_event embedded in struct pyrf_event and called evsel__parse_sample() a second time to re-parse the sample against the copied buffer. In the common case, the Python callback inspects the event and returns without storing a reference to it. Avoid the event memcpy, the duplicate evsel__parse_sample() call, and the large PyObject allocation by: 1. Storing pointers to the underlying union perf_event and struct perf_sample in struct pyrf_event (using PyGetSetDef descriptors backed by PyMember_GetOne() to read fields through those pointers), shrinking struct pyrf_event so it fits in CPython's small-object allocator pool. 2. Borrowing the event and pre-parsed sample pointers from process_events() for the duration of the Python callback. 3. Checking Py_REFCNT(pyevent) > 1 after the callback returns and only allocating event_copy and re-parsing into sample_storage when the Python callback retained a reference to the event object (or immediately in pyrf_evlist__read_on_cpu() where no pre-parsed sample is passed). Assisted-by: Antigravity:gemini-3.1-pro Signed-off-by: Ian Rogers <irogers@google.com> Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions