perf session: Remove last reference to hists struct
authorArnaldo Carvalho de Melo <acme@redhat.com>
Fri, 10 Oct 2014 18:49:21 +0000 (15:49 -0300)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 14 Oct 2014 14:41:25 +0000 (11:41 -0300)
Now perf_session doesn't require that the evsels in its evlist are hists
containing ones.

Tools that are hists based and want to do per evsel events_stats
updates, if at some point this turns into a necessity, should do it in
the tool specific code, keeping the session class hists agnostic.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: David Ahern <dsahern@gmail.com>
Cc: Don Zickus <dzickus@redhat.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-cli1bgwpo82mdikuhy3djsuy@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/builtin-annotate.c
tools/perf/builtin-report.c
tools/perf/util/hist.c
tools/perf/util/hist.h
tools/perf/util/session.c
tools/perf/util/session.h

index c9a119e2113d03b1b44674096eb85fe9a950b6aa..a5969fa64503529fc0636d99090f1f39f636733e 100644 (file)
@@ -214,6 +214,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
 
        if (dump_trace) {
                perf_session__fprintf_nr_events(session, stdout);
+               perf_evlist__fprintf_nr_events(session->evlist, stdout);
                goto out;
        }
 
index 3750d635f0f7507df319045a43a73bb58668e906..8043b5a7240a19ef8973e5764b2e46a73d4c5934 100644 (file)
@@ -487,6 +487,7 @@ static int __cmd_report(struct report *rep)
 
                if (dump_trace) {
                        perf_session__fprintf_nr_events(session, stdout);
+                       perf_evlist__fprintf_nr_events(session->evlist, stdout);
                        return 0;
                }
        }
index f72ad9c36e39f70be70c78fbac29ca2050d0e075..b143e404e5b135e90b841a1a2414bb383476ebe8 100644 (file)
@@ -3,6 +3,7 @@
 #include "hist.h"
 #include "session.h"
 #include "sort.h"
+#include "evlist.h"
 #include "evsel.h"
 #include "annotate.h"
 #include <math.h>
@@ -1405,6 +1406,21 @@ int hists__link(struct hists *leader, struct hists *other)
        return 0;
 }
 
+
+size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp)
+{
+       struct perf_evsel *pos;
+       size_t ret = 0;
+
+       evlist__for_each(evlist, pos) {
+               ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos));
+               ret += events_stats__fprintf(&evsel__hists(pos)->stats, fp);
+       }
+
+       return ret;
+}
+
+
 u64 hists__total_period(struct hists *hists)
 {
        return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period :
index 04a46e32f42fc7608ff1b7f7dab2f4c51267c3e8..a039cd22b23cdcf9cca39f1d6a47502c5586daea 100644 (file)
@@ -139,6 +139,7 @@ size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
 
 size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
                      int max_cols, float min_pcnt, FILE *fp);
+size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp);
 
 void hists__filter_by_dso(struct hists *hists);
 void hists__filter_by_thread(struct hists *hists);
index 66cae50b5c4c7ad7630d385effd0fa0c117171b9..896bac73ea08f6dbbf84bc2c642b13e3a7f23685 100644 (file)
@@ -1375,16 +1375,9 @@ size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp
 
 size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
 {
-       struct perf_evsel *pos;
        size_t ret = fprintf(fp, "Aggregated stats:\n");
 
        ret += events_stats__fprintf(&session->stats, fp);
-
-       evlist__for_each(session->evlist, pos) {
-               ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos));
-               ret += events_stats__fprintf(&evsel__hists(pos)->stats, fp);
-       }
-
        return ret;
 }
 
index ffb440462008ef55e65884d1849c22af9bb73856..a4be851f1a90e0c7a4450aece2bdb80c878b9dbd 100644 (file)
@@ -2,7 +2,6 @@
 #define __PERF_SESSION_H
 
 #include "trace-event.h"
-#include "hist.h"
 #include "event.h"
 #include "header.h"
 #include "machine.h"