@@ -28,6 +28,8 @@ struct tracefs_dynevent;
C_OBJECT_WRAPPER_DECLARE(tracefs_dynevent, PyDynevent);
+C_OBJECT_WRAPPER_DECLARE(tracefs_hist, PyTraceHist)
+
PyObject *PyTepRecord_time(PyTepRecord* self);
PyObject *PyTepRecord_cpu(PyTepRecord* self);
@@ -168,6 +168,14 @@ C_OBJECT_WRAPPER(tracefs_dynevent, PyDynevent,
dynevent_destroy,
tracefs_dynevent_free)
+static PyMethodDef PyTraceHist_methods[] = {
+ {NULL, NULL, 0, NULL}
+};
+
+C_OBJECT_WRAPPER(tracefs_hist, PyTraceHist,
+ NO_DESTROY,
+ tracefs_hist_free)
+
static PyMethodDef ftracepy_methods[] = {
{"dir",
(PyCFunction) PyFtrace_dir,
@@ -387,6 +395,9 @@ PyMODINIT_FUNC PyInit_ftracepy(void)
if (!PyDyneventTypeInit())
return NULL;
+ if (!PyTraceHistTypeInit())
+ return NULL;
+
TFS_ERROR = PyErr_NewException("tracecruncher.ftracepy.tfs_error",
NULL, NULL);
@@ -403,7 +414,7 @@ PyMODINIT_FUNC PyInit_ftracepy(void)
PyModule_AddObject(module, "tep_record", (PyObject *) &PyTepRecordType);
PyModule_AddObject(module, "tracefs_instance", (PyObject *) &PyTfsInstanceType);
PyModule_AddObject(module, "tracefs_dynevent", (PyObject *) &PyDyneventType);
-
+ PyModule_AddObject(module, "tracefs_hist", (PyObject *) &PyTraceHistType);
PyModule_AddObject(module, "tfs_error", TFS_ERROR);
PyModule_AddObject(module, "tep_error", TEP_ERROR);
The new Python type will be used to implement new APIs for working with histograms. Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com> --- src/ftracepy-utils.h | 2 ++ src/ftracepy.c | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-)