From fc3d9428b3c664d2c4848b01fc52bbac31690f08 Mon Sep 17 00:00:00 2001

From: lorenzo carrozzo <lorenzocarrozzol@gmail.com>

Date: Thu, 7 Dec 2023 14:38:15 +0000

Subject: [PATCH] bcc/python: add perf_custom_event_open



---

 src/python/bcc/perf.py | 6 ++++++

 1 file changed, 6 insertions(+)



diff --git a/src/python/bcc/perf.py b/src/python/bcc/perf.py

index 513274375d73..213b56539507 100644

--- a/src/python/bcc/perf.py

+++ b/src/python/bcc/perf.py

@@ -190,3 +190,9 @@ def perf_event_open(tpoint_id, pid=-1, ptype=PERF_TYPE_TRACEPOINT,

 

                 for cpu in get_online_cpus():

                         Perf._open_for_cpu(cpu, attr)

+

+        @staticmethod

+        def perf_custom_event_open(attr, pid=-1):

+                attr.pid = pid

+                for cpu in get_online_cpus():

+                        Perf._open_for_cpu(cpu, attr)