@@ -781,6 +781,27 @@ static PyObject *pyrf_evsel__open(struct pyrf_evsel *pevsel,
781
781
return Py_None ;
782
782
}
783
783
784
+ static PyObject * pyrf_evsel__cpus (struct pyrf_evsel * pevsel )
785
+ {
786
+ struct pyrf_cpu_map * pcpu_map = PyObject_New (struct pyrf_cpu_map , & pyrf_cpu_map__type );
787
+
788
+ if (pcpu_map )
789
+ pcpu_map -> cpus = perf_cpu_map__get (pevsel -> evsel .core .cpus );
790
+
791
+ return (PyObject * )pcpu_map ;
792
+ }
793
+
794
+ static PyObject * pyrf_evsel__threads (struct pyrf_evsel * pevsel )
795
+ {
796
+ struct pyrf_thread_map * pthread_map =
797
+ PyObject_New (struct pyrf_thread_map , & pyrf_thread_map__type );
798
+
799
+ if (pthread_map )
800
+ pthread_map -> threads = perf_thread_map__get (pevsel -> evsel .core .threads );
801
+
802
+ return (PyObject * )pthread_map ;
803
+ }
804
+
784
805
static PyObject * pyrf_evsel__str (PyObject * self )
785
806
{
786
807
struct pyrf_evsel * pevsel = (void * )self ;
@@ -799,6 +820,18 @@ static PyMethodDef pyrf_evsel__methods[] = {
799
820
.ml_flags = METH_VARARGS | METH_KEYWORDS ,
800
821
.ml_doc = PyDoc_STR ("open the event selector file descriptor table." )
801
822
},
823
+ {
824
+ .ml_name = "cpus" ,
825
+ .ml_meth = (PyCFunction )pyrf_evsel__cpus ,
826
+ .ml_flags = METH_NOARGS ,
827
+ .ml_doc = PyDoc_STR ("CPUs the event is to be used with." )
828
+ },
829
+ {
830
+ .ml_name = "threads" ,
831
+ .ml_meth = (PyCFunction )pyrf_evsel__threads ,
832
+ .ml_flags = METH_NOARGS ,
833
+ .ml_doc = PyDoc_STR ("threads the event is to be used with." )
834
+ },
802
835
{ .ml_name = NULL , }
803
836
};
804
837
0 commit comments