@@ -228,3 +228,24 @@ int cxl_parse_events(struct tracefs_instance *inst, struct event_ctx *ectx)
tep_free(tep);
return rc;
}
+
+int cxl_event_tracing_enable(struct tracefs_instance *inst, const char *system,
+ const char *event)
+{
+ int rc;
+
+ rc = tracefs_event_enable(inst, system, event);
+ if (rc == -1)
+ return -errno;
+
+ if (tracefs_trace_is_on(inst))
+ return 0;
+
+ tracefs_trace_on(inst);
+ return 0;
+}
+
+int cxl_event_tracing_disable(struct tracefs_instance *inst)
+{
+ return tracefs_trace_off(inst);
+}
@@ -20,5 +20,8 @@ struct event_ctx {
};
int cxl_parse_events(struct tracefs_instance *inst, struct event_ctx *ectx);
+int cxl_event_tracing_enable(struct tracefs_instance *inst, const char *system,
+ const char *event);
+int cxl_event_tracing_disable(struct tracefs_instance *inst);
#endif
Add a common function for cxl command to enable and disable event tracing for the instance created. Will only enable "cxl" system. Signed-off-by: Dave Jiang <dave.jiang@intel.com> --- cxl/event_trace.c | 21 +++++++++++++++++++++ cxl/event_trace.h | 3 +++ 2 files changed, 24 insertions(+)