]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
perf ordered_events: Add first_time() method
authorJiri Olsa <jolsa@kernel.org>
Thu, 6 Dec 2018 17:38:52 +0000 (14:38 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Mon, 17 Dec 2018 18:02:17 +0000 (15:02 -0300)
To get the timestamp in the first event in the queue.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Dmitry Levin <ldv@altlinux.org>
Cc: Eugene Syromiatnikov <esyr@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Luis Cláudio Gonçalves <lclaudio@uudg.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/n/tip-appp27jw1ul8kgg872j43r5o@git.kernel.org
[ split from a larger patch ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/ordered-events.c
tools/perf/util/ordered-events.h

index 46965643020b00e933e738724325f0abe176418a..897589507d97cba2c09ccb6676bd25e02212c9d8 100644 (file)
@@ -343,6 +343,17 @@ int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp)
        return __ordered_events__flush(oe, OE_FLUSH__TIME, timestamp);
 }
 
+u64 ordered_events__first_time(struct ordered_events *oe)
+{
+       struct ordered_event *event;
+
+       if (list_empty(&oe->events))
+               return 0;
+
+       event = list_first_entry(&oe->events, struct ordered_event, list);
+       return event->timestamp;
+}
+
 void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
                          void *data)
 {
index f352af20e167b13196008c9c092f8bf4879fdc64..0920fb0ec6cc7f98c5c84a56555eb9c49997c81a 100644 (file)
@@ -61,6 +61,7 @@ void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t d
                          void *data);
 void ordered_events__free(struct ordered_events *oe);
 void ordered_events__reinit(struct ordered_events *oe);
+u64 ordered_events__first_time(struct ordered_events *oe);
 
 static inline
 void ordered_events__set_alloc_size(struct ordered_events *oe, u64 size)