diff options
author | Josef Bacik <jbacik@fb.com> | 2014-07-21 17:35:38 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2015-06-10 15:11:12 -0400 |
commit | f267243158b247fa7400744fd9b5c8a9bd94d085 (patch) | |
tree | bb0fd8bab52ea9540466e2a8adfa43c9142976af | |
parent | 972f8d0f102eb64ba5147b3478c13fbacf7b6de9 (diff) | |
download | trace-cmd-f267243158b247fa7400744fd9b5c8a9bd94d085.tar.gz |
trace-cmd: Add read_next_event to Trace python class
I need to be able to just cycle through the events in a trace.dat file without
worrying about the CPU, so add read_next_event that mirrors the other
read_event* functions to call tracecmd_read_next_data.
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r-- | tracecmd.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tracecmd.py b/tracecmd.py index 9c07cf63..cdd619b2 100644 --- a/tracecmd.py +++ b/tracecmd.py @@ -212,6 +212,15 @@ class Trace(object): # rec ownership goes over to Event instance return Event(self._pevent, rec, format) + def read_next_event(self): + res = tracecmd_read_next_data(self._handle) + if isinstance(res, int): + return None + rec, cpu = res + type = pevent_data_type(self._pevent, rec) + format = pevent_data_event_from_type(self._pevent, type) + return Event(self._pevent, rec, format) + def peek_event(self, cpu): rec = tracecmd_peek_data_ref(self._handle, cpu) if rec is None: |