4 #include <linux/list.h> 5 #include <linux/compiler.h> 6 #include <linux/string.h> 12 #define pr_N(n, fmt, ...) \ 13 eprintf(n, debug_ordered_events, fmt, ##__VA_ARGS__) 15 #define pr(fmt, ...) pr_N(1, pr_fmt(fmt), ##__VA_ARGS__) 49 list_add_tail(&
new->list, &last->
list);
59 list_add(&
new->list, &last->
list);
69 new_event = memdup(event, event->
header.size);
91 #define MAX_SAMPLE_BUFFER (64 * 1024 / sizeof(struct ordered_event)) 95 struct list_head *cache = &oe->
cache;
103 if (!list_empty(cache)) {
105 list_del(&
new->list);
119 pr(
"alloc size %" PRIu64
"B (+%zu), max %" PRIu64
"B\n",
132 new->event = new_event;
164 if (!timestamp || timestamp == ~0ULL)
167 if (timestamp < oe->last_flush) {
168 pr_oe_time(timestamp,
"out of order event\n");
190 struct list_head *head = &oe->
events;
194 bool show_progress = limit == ULLONG_MAX;
204 list_for_each_entry_safe(iter, tmp, head, list) {
221 if (list_empty(head))
223 else if (last_ts <= limit)
234 static const char *
const str[] = {
253 struct list_head *head = &oe->
events;
259 if (WARN_ONCE(!last || list_empty(head),
"empty queue"))
295 INIT_LIST_HEAD(&oe->
events);
296 INIT_LIST_HEAD(&oe->
cache);
305 while (!list_empty(&oe->
to_free)) {
309 list_del(&event->
list);
320 memset(oe,
'\0',
sizeof(*oe));
void ui_progress__update(struct ui_progress *p, u64 adv)
#define pr_oe_time(t, fmt,...)
void ordered_events__reinit(struct ordered_events *oe)
struct ordered_event * buffer
static void free_dup_event(struct ordered_events *oe, union perf_event *event)
static union perf_event * __dup_event(struct ordered_events *oe, union perf_event *event)
int(* ordered_events__deliver_t)(struct ordered_events *oe, struct ordered_event *event)
x86 movsq based memset() in arch/x86/lib/memset_64.S") MEMSET_FN(memset_erms
static struct ordered_event * ordered_events__new_event(struct ordered_events *oe, u64 timestamp, union perf_event *event)
static struct ordered_event * alloc_event(struct ordered_events *oe, union perf_event *event)
ordered_events__deliver_t deliver
enum oe_flush last_flush_type
void ordered_events__free(struct ordered_events *oe)
void ordered_events__delete(struct ordered_events *oe, struct ordered_event *event)
static int str(yyscan_t scanner, int token)
#define MAX_SAMPLE_BUFFER
#define ui_progress__init(p, total, title)
int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)
void ordered_events__init(struct ordered_events *oe, ordered_events__deliver_t deliver)
struct perf_event_header header
void ui_progress__finish(void)
static int __ordered_events__flush(struct ordered_events *oe)
#define pr_oe_time2(t, fmt,...)
int ordered_events__queue(struct ordered_events *oe, union perf_event *event, u64 timestamp, u64 file_offset)
struct ordered_event * last
static union perf_event * dup_event(struct ordered_events *oe, union perf_event *event)
static void queue_event(struct ordered_events *oe, struct ordered_event *new)