perf ordered_samples: Remove references to perf_{evlist,tool} and machines
tip-bot for Arnaldo Carvalho de Melo
merge botCommit-ID: 9870d7809575515e26194f4b3df1750872a6ee60 Gitweb: http://git.kernel.org/tip/9870d7809575515e26194f4b3df1750872a6ee60 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Tue, 31 Mar 2015 12:48:16 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Tue, 31 Mar 2015 17:52:32 -0300
perf ordered_samples: Remove references to perf_{evlist,tool} and machines
As these can be obtained from the ordered_events pointer, via container_of, reducing the cross section of ordered_samples.
These were added to ordered_samples in:
commit b7b61cbebd789a3dbca522e3fdb727fe5c95593f
Author: Arnaldo Carvalho de Melo <[email protected]>
Date: Tue Mar 3 11:58:45 2015 -0300
perf ordered_events: Shorten function signatures
By keeping pointers to machines, evlist and tool in ordered_events.
But that was more a transitional patch while moving stuff out from perf_session.c to ordered_events.c and possibly not even needed by then, as we could use the container_of() method and instead of having the nr_unordered_samples stats in events_stats, we can have it in ordered_samples.
--- tools/perf/util/event.h | 1 - tools/perf/util/ordered-events.c | 21 ++++-------------- tools/perf/util/ordered-events.h | 14 +++--------- tools/perf/util/session.c | 47 +++++++++++++++++++++++++--------------- tools/perf/util/session.h | 1 + 5 files changed, 37 insertions(+), 47 deletions(-)
tools/perf/util/event.h +0 -1
@@ -242,7 +242,6 @@ struct events_stats {u32 nr_invalid_chains;u32 nr_unknown_id;u32 nr_unprocessable_samples; -u32 nr_unordered_events; };struct attr_event {
tools/perf/util/ordered-events.c +4 -17
@@ -2,7 +2,6 @@#include <linux/compiler.h> #include <linux/string.h> #include "ordered-events.h" -#include "evlist.h" #include "session.h" #include "asm/bug.h" #include "debug.h"
@@ -167,7 +166,7 @@ int ordered_events__queue(struct ordered_events *oe, union perf_event *event,pr_oe_time (oe->last_flush,"last flush, last_flush_type %d\n" , oe->last_flush_type); - oe->evlist->stats.nr_unordered_events++; + oe->nr_unordered_events++; } oevent =ordered_events__new_event (oe, timestamp, event);
@@ -187,7 +186,6 @@ static int __ordered_events__flush(struct ordered_events *oe) {struct list_head *head = &oe->events;struct ordered_event *tmp, *iter; -struct perf_sample sample;u64 limit = oe->next_flush;u64 last_ts = oe->last ? oe->last->timestamp :0ULL ;bool show_progress = limit ==ULLONG_MAX ;
@@ -206,15 +204,9 @@ static int __ordered_events__flush(struct ordered_events *oe)if (iter->timestamp > limit)break ; - - ret =perf_evlist__parse_sample (oe->evlist, iter->event, &sample); + ret = oe->deliver (oe, iter);if (ret) -pr_err ("Can't parse sample, err = %d\n" , ret); -else { - ret = oe->deliver (oe, iter, &sample); -if (ret) -return ret; - } +return ret;ordered_events__delete (oe, iter); oe->last_flush = iter->timestamp;
@@ -292,18 +284,13 @@ int ordered_events__flush(struct ordered_events *oe, enum oe_flush how)return err; } -void ordered_events__init (struct ordered_events *oe,struct machines *machines, -struct perf_evlist *evlist,struct perf_tool *tool, -ordered_events__deliver_t deliver) +void ordered_events__init (struct ordered_events *oe,ordered_events__deliver_t deliver) {INIT_LIST_HEAD (&oe->events);INIT_LIST_HEAD (&oe->cache);INIT_LIST_HEAD (&oe->to_free); oe->max_alloc_size = (u64) -1 ; oe->cur_alloc_size =0 ; - oe->evlist = evlist; - oe->machines = machines; - oe->tool = tool; oe->deliver = deliver; }
tools/perf/util/ordered-events.h +3 -11
@@ -3,10 +3,7 @@#include <linux/types.h> -struct perf_tool ; -struct perf_evlist ;struct perf_sample ; -struct machines ;struct ordered_event {u64 timestamp;
@@ -25,8 +22,7 @@ enum oe_flush {struct ordered_events ;typedef int (*ordered_events__deliver_t )(struct ordered_events *oe, -struct ordered_event *event, -struct perf_sample *sample); +struct ordered_event *event);struct ordered_events {u64 last_flush;
@@ -39,13 +35,11 @@ struct ordered_events {struct list_head to_free;struct ordered_event *buffer;struct ordered_event *last; -struct machines *machines; -struct perf_evlist *evlist; -struct perf_tool *tool;ordered_events__deliver_t deliver;int buffer_idx;unsigned int nr_events;enum oe_flush last_flush_type; +u32 nr_unordered_events;bool copy_on_queue; };
@@ -53,9 +47,7 @@ int ordered_events__queue(struct ordered_events *oe, union perf_event *event, struct perf_sample *sample, u64 file_offset);void ordered_events__delete (struct ordered_events *oe,struct ordered_event *event);int ordered_events__flush (struct ordered_events *oe,enum oe_flush how); -void ordered_events__init (struct ordered_events *oe,struct machines *machines, -struct perf_evlist *evlsit,struct perf_tool *tool, -ordered_events__deliver_t deliver); +void ordered_events__init (struct ordered_events *oe,ordered_events__deliver_t deliver);void ordered_events__free (struct ordered_events *oe); static inline
tools/perf/util/session.c +29 -18
116 lines not on this page · raw message
tools/perf/util/session.h +1 -0
@@ -26,6 +26,7 @@ struct perf_session {u64 one_mmap_offset;struct ordered_events ordered_events;struct perf_data_file *file; +struct perf_tool *tool; };#define PRINT_IP_OPT_IP (1<<0)