Skip to content

Commit

Permalink
perf session: Remove last reference to hists struct
Browse files Browse the repository at this point in the history
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 <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: David Ahern <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Frederic Weisbecker <[email protected]>
Cc: Jean Pihet <[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]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Oct 14, 2014
1 parent 95e8d97 commit 2a1731f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions tools/perf/builtin-annotate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions tools/perf/builtin-report.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
16 changes: 16 additions & 0 deletions tools/perf/util/hist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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 :
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/hist.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 0 additions & 7 deletions tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
1 change: 0 additions & 1 deletion tools/perf/util/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define __PERF_SESSION_H

#include "trace-event.h"
#include "hist.h"
#include "event.h"
#include "header.h"
#include "machine.h"
Expand Down

0 comments on commit 2a1731f

Please sign in to comment.