perf scripting python: Assign perf_script_context
The scripting_context pointer itself does not change and nor does it need to. Put it directly into the script as a variable at the start so it does not have to be passed on each call into the script. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Andi Kleen <ak@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Link: https://lore.kernel.org/r/20210530192308.7382-6-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
committed by
Arnaldo Carvalho de Melo
parent
67e50ce0e3
commit
cf9bfa6c15
@@ -91,6 +91,12 @@ PyMODINIT_FUNC PyInit_perf_trace_context(void)
|
||||
NULL, /* m_clear */
|
||||
NULL, /* m_free */
|
||||
};
|
||||
return PyModule_Create(&moduledef);
|
||||
PyObject *mod;
|
||||
|
||||
mod = PyModule_Create(&moduledef);
|
||||
/* Add perf_script_context to the module so it can be imported */
|
||||
PyObject_SetAttrString(mod, "perf_script_context", Py_None);
|
||||
|
||||
return mod;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user