perf session: There is no need for a per session hists instance
Commit-ID: 28a6b6aa54878a6a239e901698b3fc111bbcc54f Gitweb: http://git.kernel.org/tip/28a6b6aa54878a6a239e901698b3fc111bbcc54f Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Tue, 18 Dec 2012 16:24:46 -0300 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitDate: Thu, 24 Jan 2013 16:40:12 -0300
perf session: There is no need for a per session hists instance
It was being used just for its stats member, so ditch session->hists and use just what is needed, session->stats.
This completes the move support multiple events in the hists layer, the last user of session->hists was 'perf diff' but Jiri Olsa has fixed that some time ago.
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Mike Galbraith <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Paul Mackerras <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephane Eranian <[email protected]>
Signed-off-by Arnaldo Carvalho de Melo <[email protected]>
--- tools/perf/builtin-sched.c | 6 +++--- tools/perf/builtin-top.c | 4 ++-- tools/perf/util/hist.c | 9 +++++++-- tools/perf/util/hist.h | 1 + tools/perf/util/session.c | 41 ++++++++++++++++++++--------------------- tools/perf/util/session.h | 6 +----- 6 files changed, 34 insertions(+), 33 deletions(-)
tools/perf/builtin-sched.c +3 -3
@@ -1475,9 +1475,9 @@ static int perf_sched__read_events(struct perf_sched *sched, bool destroy, goto out_delete; } - sched->nr_events = session->hists.stats.nr_events[0 ]; - sched->nr_lost_events = session->hists.stats.total_lost; - sched->nr_lost_chunks = session->hists.stats.nr_events[PERF_RECORD_LOST ]; + sched->nr_events = session->stats.nr_events[0 ]; + sched->nr_lost_events = session->stats.total_lost; + sched->nr_lost_chunks = session->stats.nr_events[PERF_RECORD_LOST ]; }if (destroy)
tools/perf/builtin-top.c +2 -2
@@ -728,7 +728,7 @@ static void perf_event__process_sample(struct perf_tool *tool,if (!machine) {pr_err ("%u unprocessable samples recorded.\n" , - top->session->hists.stats.nr_unprocessable_samples++); + top->session->stats.nr_unprocessable_samples++);return ; }
@@ -878,7 +878,7 @@ static void perf_top__mmap_read_idx(struct perf_top *top, int idx)hists__inc_nr_events (&evsel->hists, event->header.type);machine__process_event (machine, event); }else - ++session->hists.stats.nr_unknown_events; + ++session->stats.nr_unknown_events; } }
tools/perf/util/hist.c +7 -2
@@ -717,10 +717,15 @@ int hist_entry__annotate(struct hist_entry *he, size_t privsize)return symbol__annotate (he->ms.sym, he->ms.map, privsize); } +void events_stats__inc (struct events_stats *stats,u32 type) +{ + ++stats->nr_events[0 ]; + ++stats->nr_events[type]; +} +void hists__inc_nr_events (struct hists *hists,u32 type) { - ++hists->stats.nr_events[0 ]; - ++hists->stats.nr_events[type]; +events_stats__inc (&hists->stats, type); } static struct hist_entry *hists__add_dummy_entry(struct hists *hists,
tools/perf/util/hist.h +1 -0
@@ -98,6 +98,7 @@ void hists__output_recalc_col_len(struct hists *hists, int max_rows);void hists__inc_nr_entries (struct hists *hists,struct hist_entry *h);void hists__inc_nr_events (struct hists *self,u32 type); +void events_stats__inc (struct events_stats *stats,u32 type);size_t events_stats__fprintf (struct events_stats *stats,FILE *fp); size_t hists__fprintf(struct hists *self, bool show_header, int max_rows,
tools/perf/util/session.c +20 -21
113 lines not on this page · raw message
tools/perf/util/session.h +1 -5
@@ -34,11 +34,7 @@ struct perf_session {struct rb_root machines;struct perf_evlist *evlist;struct pevent *pevent; -/* -* FIXME: Need to split this up further, we need global -* stats + per event stats. -*/ -struct hists hists; +struct events_stats stats;int fd;bool fd_pipe;bool repipe;