@@ -14,6 +14,8 @@ SYNOPSIS
char pass:[*]pass:[*]*tracefs_event_systems*(const char pass:[*]_tracing_dir_);
char pass:[*]pass:[*]*tracefs_system_events*(const char pass:[*]_tracing_dir_, const char pass:[*]_system_);
+int *tracefs_event_enable*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_system_, const char pass:[*]_event_);
+int *tracefs_event_disable*(struct tracefs_instance pass:[*]_instance_, const char pass:[*]_system_, const char pass:[*]_event_);
int *tracefs_iterate_raw_events*(struct tep_handle pass:[*]_tep_, struct tracefs_instance pass:[*]_instance_, cpu_set_t pass:[*]_cpus_, int _cpu_size_, int (pass:[*]_callback_)(struct tep_event pass:[*], struct tep_record pass:[*], int, void pass:[*]), void pass:[*]_callback_context_);
--
@@ -37,6 +39,22 @@ local machine, or it may be a path to a copy of the tracefs directory
from another machine. The last entry in the array as a NULL pointer.
The array must be freed with _tracefs_list_free()_ API.
+The _tracefs_event_enable()_ function enables a given event based on
+the _system_ and _event_ passed in for the given _instance_. If _instance_
+is NULL, then the top level tracing directory is used. If _system_
+and _event_ are both NULL, then all events are enabled for the _instance_.
+If _event_ is NULL then all events within the _system_ are enabled.
+If _system_ is NULL, then all systems are searched and any event within
+a system that matches _event_ is enabled. Both _system_ and _event_ may
+be regular expressions as defined by *regex*(3).
+
+The _tracefs_event_disable()_ function disables the events that match
+the _system_ and _event_ parameters for the given _instance_. What events
+are disable follow the same rules as _tracefs_event_enable()_ for matching
+events. That is, if _instance_ is NULL, then the top level tracing directory
+is used. If both _system_ and _event_ are NULL then all events are disabled
+for the given _instance_, and so on.
+
The _tracefs_iterate_raw_events()_ function will read the tracefs raw
data buffers and call the specified _callback_ function for every event it
encounters. Events are iterated in sorted order: oldest first. An initialized
@@ -59,6 +77,14 @@ The _tracefs_event_systems()_ and __tracefs_system_events()_ functions return
an array of strings. The last element in that array is a NULL pointer. The array
must be freed with _tracefs_list_free()_ API. In case of an error, NULL is returned.
+Both _tracefs_event_enable()_ and _tracefs_event_disable()_ return 0 if they found
+any matching events (Note it does not check the previous status of the event. If
+_tracefs_event_enable()_ finds an event that is already enabled, and there are no
+other errors, then it will return 0). If an error occurs, even if other events were
+found, it will return -1 and errno will be set. If no errors occur, but no events
+are found that match the _system_ and _event_ parameters, then -1 is returned
+and errno is not set.
+
The _tracefs_iterate_raw_events()_ function returns -1 in case of an error or
0 otherwise.
@@ -102,9 +128,19 @@ struct tep_event *tep = tracefs_local_events(NULL);
/* Failed to initialise tep handler with local events */
...
}
+
+ errno = 0;
+ ret = tracefs_event_enable(NULL, "sched", NULL);
+ if (ret < 0 && !errno)
+ printf("Could not find 'sched' events\n");
+ tracefs_event_enable(NULL, "irq", "irq_handler_\(enter\|exit\)");
+
if (tracefs_iterate_raw_events(tep, NULL, NULL, 0, records_walk, NULL) < 0) {
/* Error walking through the recorded raw events */
}
+
+ /* Disable all events */
+ tracefs_event_disable(NULL, NULL, NULL);
tep_free(tep);
--
FILES