Skip to content

Commit 68ca5d0

Browse files
olsajiriacmel
authored andcommitted
perf ordered_events: Add ordered_events__flush_time interface
Add OE_FLUSH__TIME flush type, to be able to flush only certain amount of the queue based on the provided timestamp. It will be used in the following patches. Signed-off-by: Jiri Olsa <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Dmitry Levin <[email protected]> Cc: Eugene Syromiatnikov <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Luis Cláudio Gonçalves <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Steven Rostedt (VMware) <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/[email protected] [ Fix the build on older systems such as centos 5 and 6 where 'time' shadows a global declaration ] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 6d99a79 commit 68ca5d0

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

tools/perf/util/ordered-events.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,7 @@ int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
219219
return 0;
220220
}
221221

222-
static int __ordered_events__flush(struct ordered_events *oe,
223-
bool show_progress)
222+
static int do_flush(struct ordered_events *oe, bool show_progress)
224223
{
225224
struct list_head *head = &oe->events;
226225
struct ordered_event *tmp, *iter;
@@ -263,7 +262,8 @@ static int __ordered_events__flush(struct ordered_events *oe,
263262
return 0;
264263
}
265264

266-
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
265+
static int __ordered_events__flush(struct ordered_events *oe, enum oe_flush how,
266+
u64 timestamp)
267267
{
268268
static const char * const str[] = {
269269
"NONE",
@@ -302,6 +302,11 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
302302
break;
303303
}
304304

305+
case OE_FLUSH__TIME:
306+
oe->next_flush = timestamp;
307+
show_progress = false;
308+
break;
309+
305310
case OE_FLUSH__ROUND:
306311
case OE_FLUSH__NONE:
307312
default:
@@ -312,7 +317,7 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
312317
str[how], oe->nr_events);
313318
pr_oe_time(oe->max_timestamp, "max_timestamp\n");
314319

315-
err = __ordered_events__flush(oe, show_progress);
320+
err = do_flush(oe, show_progress);
316321

317322
if (!err) {
318323
if (how == OE_FLUSH__ROUND)
@@ -328,6 +333,16 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
328333
return err;
329334
}
330335

336+
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
337+
{
338+
return __ordered_events__flush(oe, how, 0);
339+
}
340+
341+
int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp)
342+
{
343+
return __ordered_events__flush(oe, OE_FLUSH__TIME, timestamp);
344+
}
345+
331346
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
332347
void *data)
333348
{

tools/perf/util/ordered-events.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ enum oe_flush {
1919
OE_FLUSH__ROUND,
2020
OE_FLUSH__HALF,
2121
OE_FLUSH__TOP,
22+
OE_FLUSH__TIME,
2223
};
2324

2425
struct ordered_events;
@@ -55,6 +56,7 @@ int ordered_events__queue(struct ordered_events *oe, union perf_event *event,
5556
u64 timestamp, u64 file_offset);
5657
void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event);
5758
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how);
59+
int ordered_events__flush_time(struct ordered_events *oe, u64 timestamp);
5860
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver,
5961
void *data);
6062
void ordered_events__free(struct ordered_events *oe);

0 commit comments

Comments
 (0)