Skip to content

Commit 2a1731f

Browse files
committed
perf session: Remove last reference to hists struct
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>
1 parent 95e8d97 commit 2a1731f

6 files changed

Lines changed: 19 additions & 8 deletions

File tree

‎tools/perf/builtin-annotate.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ static int __cmd_annotate(struct perf_annotate *ann)
214214

215215
if (dump_trace) {
216216
perf_session__fprintf_nr_events(session, stdout);
217+
perf_evlist__fprintf_nr_events(session->evlist, stdout);
217218
goto out;
218219
}
219220

‎tools/perf/builtin-report.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ static int __cmd_report(struct report *rep)
487487

488488
if (dump_trace) {
489489
perf_session__fprintf_nr_events(session, stdout);
490+
perf_evlist__fprintf_nr_events(session->evlist, stdout);
490491
return 0;
491492
}
492493
}

‎tools/perf/util/hist.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#include "hist.h"
44
#include "session.h"
55
#include "sort.h"
6+
#include "evlist.h"
67
#include "evsel.h"
78
#include "annotate.h"
89
#include <math.h>
@@ -1405,6 +1406,21 @@ int hists__link(struct hists *leader, struct hists *other)
14051406
return 0;
14061407
}
14071408

1409+
1410+
size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp)
1411+
{
1412+
struct perf_evsel *pos;
1413+
size_t ret = 0;
1414+
1415+
evlist__for_each(evlist, pos) {
1416+
ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos));
1417+
ret += events_stats__fprintf(&evsel__hists(pos)->stats, fp);
1418+
}
1419+
1420+
return ret;
1421+
}
1422+
1423+
14081424
u64 hists__total_period(struct hists *hists)
14091425
{
14101426
return symbol_conf.filter_relative ? hists->stats.total_non_filtered_period :

‎tools/perf/util/hist.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ size_t events_stats__fprintf(struct events_stats *stats, FILE *fp);
139139

140140
size_t hists__fprintf(struct hists *hists, bool show_header, int max_rows,
141141
int max_cols, float min_pcnt, FILE *fp);
142+
size_t perf_evlist__fprintf_nr_events(struct perf_evlist *evlist, FILE *fp);
142143

143144
void hists__filter_by_dso(struct hists *hists);
144145
void hists__filter_by_thread(struct hists *hists);

‎tools/perf/util/session.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,16 +1375,9 @@ size_t perf_session__fprintf_dsos_buildid(struct perf_session *session, FILE *fp
13751375

13761376
size_t perf_session__fprintf_nr_events(struct perf_session *session, FILE *fp)
13771377
{
1378-
struct perf_evsel *pos;
13791378
size_t ret = fprintf(fp, "Aggregated stats:\n");
13801379

13811380
ret += events_stats__fprintf(&session->stats, fp);
1382-
1383-
evlist__for_each(session->evlist, pos) {
1384-
ret += fprintf(fp, "%s stats:\n", perf_evsel__name(pos));
1385-
ret += events_stats__fprintf(&evsel__hists(pos)->stats, fp);
1386-
}
1387-
13881381
return ret;
13891382
}
13901383

‎tools/perf/util/session.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define __PERF_SESSION_H
33

44
#include "trace-event.h"
5-
#include "hist.h"
65
#include "event.h"
76
#include "header.h"
87
#include "machine.h"

0 commit comments

Comments
 (0)