aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--trace-cmd.h9
-rw-r--r--tracecmd.py8
2 files changed, 16 insertions, 1 deletions
diff --git a/trace-cmd.h b/trace-cmd.h
index 83e7a34..22b45cc 100644
--- a/trace-cmd.h
+++ b/trace-cmd.h
@@ -87,6 +87,15 @@ int tracecmd_init_data(struct tracecmd_input *handle);
87struct record * 87struct record *
88tracecmd_peek_data(struct tracecmd_input *handle, int cpu); 88tracecmd_peek_data(struct tracecmd_input *handle, int cpu);
89 89
90static inline struct record *
91tracecmd_peek_data_ref(struct tracecmd_input *handle, int cpu)
92{
93 struct record *rec = tracecmd_peek_data(handle, cpu);
94 if (rec)
95 rec->ref_count++;
96 return rec;
97}
98
90struct record * 99struct record *
91tracecmd_read_data(struct tracecmd_input *handle, int cpu); 100tracecmd_read_data(struct tracecmd_input *handle, int cpu);
92 101
diff --git a/tracecmd.py b/tracecmd.py
index 75a639d..39e7043 100644
--- a/tracecmd.py
+++ b/tracecmd.py
@@ -213,7 +213,13 @@ class Trace(object):
213 return Event(self._pevent, rec, format) 213 return Event(self._pevent, rec, format)
214 214
215 def peek_event(self, cpu): 215 def peek_event(self, cpu):
216 pass 216 rec = tracecmd_peek_data_ref(self._handle, cpu)
217 if rec is None:
218 return None
219 type = pevent_data_type(self._pevent, rec)
220 format = pevent_data_event_from_type(self._pevent, type)
221 # rec ownership goes over to Event instance
222 return Event(self._pevent, rec, format)
217 223
218 224
219# Basic builtin test, execute module directly 225# Basic builtin test, execute module directly