aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2009-12-14 10:10:39 -0500
committerIngo Molnar <mingo@elte.hu>2009-12-14 10:57:18 -0500
commit4e4f06e4c8f17ea96f7dd76251cab99511026401 (patch)
tree18b7f83b664939be0a9bde8e43daf9db8ca7fccc /tools/perf
parentb9bf089212d95746ce66482bcdbc7e77a0651088 (diff)
perf session: Move the hist_entries rb tree to perf_session
As we'll need to sort multiple times for multiple perf sessions, so that we can then do a diff. Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1260803439-16783-1-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-annotate.c19
-rw-r--r--tools/perf/builtin-kmem.c2
-rw-r--r--tools/perf/builtin-report.c55
-rw-r--r--tools/perf/builtin-sched.c2
-rw-r--r--tools/perf/builtin-timechart.c2
-rw-r--r--tools/perf/builtin-trace.c2
-rw-r--r--tools/perf/util/data_map.c2
-rw-r--r--tools/perf/util/hist.c43
-rw-r--r--tools/perf/util/hist.h43
-rw-r--r--tools/perf/util/session.h5
10 files changed, 86 insertions, 89 deletions
diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index f25e89e9c9b0..1f1341f1dd84 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -121,10 +121,12 @@ static void hist_hit(struct hist_entry *he, u64 ip)
121 h->ip[offset]); 121 h->ip[offset]);
122} 122}
123 123
124static int hist_entry__add(struct addr_location *al, u64 count) 124static int perf_session__add_hist_entry(struct perf_session *self,
125 struct addr_location *al, u64 count)
125{ 126{
126 bool hit; 127 bool hit;
127 struct hist_entry *he = __hist_entry__add(al, NULL, count, &hit); 128 struct hist_entry *he = __perf_session__add_hist_entry(self, al, NULL,
129 count, &hit);
128 if (he == NULL) 130 if (he == NULL)
129 return -ENOMEM; 131 return -ENOMEM;
130 hist_hit(he, al->addr); 132 hist_hit(he, al->addr);
@@ -144,7 +146,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
144 return -1; 146 return -1;
145 } 147 }
146 148
147 if (hist_entry__add(&al, 1)) { 149 if (perf_session__add_hist_entry(session, &al, 1)) {
148 fprintf(stderr, "problem incrementing symbol count, " 150 fprintf(stderr, "problem incrementing symbol count, "
149 "skipping event\n"); 151 "skipping event\n");
150 return -1; 152 return -1;
@@ -428,11 +430,11 @@ static void annotate_sym(struct hist_entry *he)
428 free_source_line(he, len); 430 free_source_line(he, len);
429} 431}
430 432
431static void find_annotations(void) 433static void perf_session__find_annotations(struct perf_session *self)
432{ 434{
433 struct rb_node *nd; 435 struct rb_node *nd;
434 436
435 for (nd = rb_first(&hist); nd; nd = rb_next(nd)) { 437 for (nd = rb_first(&self->hists); nd; nd = rb_next(nd)) {
436 struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node); 438 struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
437 struct sym_priv *priv; 439 struct sym_priv *priv;
438 440
@@ -484,10 +486,9 @@ static int __cmd_annotate(void)
484 if (verbose > 2) 486 if (verbose > 2)
485 dsos__fprintf(stdout); 487 dsos__fprintf(stdout);
486 488
487 collapse__resort(); 489 perf_session__collapse_resort(session);
488 output__resort(event__total[0]); 490 perf_session__output_resort(session, event__total[0]);
489 491 perf_session__find_annotations(session);
490 find_annotations();
491out_delete: 492out_delete:
492 perf_session__delete(session); 493 perf_session__delete(session);
493 494
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index e79ecbc17181..3b329c66b505 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -344,7 +344,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
344 return 0; 344 return 0;
345} 345}
346 346
347static int sample_type_check(u64 type) 347static int sample_type_check(u64 type, struct perf_session *session __used)
348{ 348{
349 sample_type = type; 349 sample_type = type;
350 350
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 9cbdcbc4cd56..854427f0e57e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -38,6 +38,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str,
38static struct strlist *dso_list, *comm_list, *sym_list; 38static struct strlist *dso_list, *comm_list, *sym_list;
39 39
40static int force; 40static int force;
41static bool use_callchain;
41 42
42static int show_nr_samples; 43static int show_nr_samples;
43 44
@@ -312,8 +313,9 @@ hist_entry_callchain__fprintf(FILE *fp, struct hist_entry *self,
312 return ret; 313 return ret;
313} 314}
314 315
315static size_t 316static size_t hist_entry__fprintf(FILE *fp, struct hist_entry *self,
316hist_entry__fprintf(FILE *fp, struct hist_entry *self, u64 total_samples) 317 struct perf_session *session,
318 u64 total_samples)
317{ 319{
318 struct sort_entry *se; 320 struct sort_entry *se;
319 size_t ret; 321 size_t ret;
@@ -345,7 +347,7 @@ hist_entry__fprintf(FILE *fp, struct hist_entry *self, u64 total_samples)
345 347
346 ret += fprintf(fp, "\n"); 348 ret += fprintf(fp, "\n");
347 349
348 if (callchain) { 350 if (session->use_callchain) {
349 int left_margin = 0; 351 int left_margin = 0;
350 352
351 if (sort__first_dimension == SORT_COMM) { 353 if (sort__first_dimension == SORT_COMM) {
@@ -422,7 +424,7 @@ static struct symbol **resolve_callchain(struct thread *thread,
422 struct symbol **syms = NULL; 424 struct symbol **syms = NULL;
423 unsigned int i; 425 unsigned int i;
424 426
425 if (callchain) { 427 if (session->use_callchain) {
426 syms = calloc(chain->nr, sizeof(*syms)); 428 syms = calloc(chain->nr, sizeof(*syms));
427 if (!syms) { 429 if (!syms) {
428 fprintf(stderr, "Can't allocate memory for symbols\n"); 430 fprintf(stderr, "Can't allocate memory for symbols\n");
@@ -454,7 +456,7 @@ static struct symbol **resolve_callchain(struct thread *thread,
454 if (sort__has_parent && !*parent && 456 if (sort__has_parent && !*parent &&
455 call__match(al.sym)) 457 call__match(al.sym))
456 *parent = al.sym; 458 *parent = al.sym;
457 if (!callchain) 459 if (!session->use_callchain)
458 break; 460 break;
459 syms[i] = al.sym; 461 syms[i] = al.sym;
460 } 462 }
@@ -467,25 +469,25 @@ static struct symbol **resolve_callchain(struct thread *thread,
467 * collect histogram counts 469 * collect histogram counts
468 */ 470 */
469 471
470static int hist_entry__add(struct addr_location *al, 472static int perf_session__add_hist_entry(struct perf_session *self,
471 struct perf_session *session, 473 struct addr_location *al,
472 struct ip_callchain *chain, u64 count) 474 struct ip_callchain *chain, u64 count)
473{ 475{
474 struct symbol **syms = NULL, *parent = NULL; 476 struct symbol **syms = NULL, *parent = NULL;
475 bool hit; 477 bool hit;
476 struct hist_entry *he; 478 struct hist_entry *he;
477 479
478 if ((sort__has_parent || callchain) && chain) 480 if ((sort__has_parent || self->use_callchain) && chain)
479 syms = resolve_callchain(al->thread, session, chain, &parent); 481 syms = resolve_callchain(al->thread, self, chain, &parent);
480 482
481 he = __hist_entry__add(al, parent, count, &hit); 483 he = __perf_session__add_hist_entry(self, al, parent, count, &hit);
482 if (he == NULL) 484 if (he == NULL)
483 return -ENOMEM; 485 return -ENOMEM;
484 486
485 if (hit) 487 if (hit)
486 he->count += count; 488 he->count += count;
487 489
488 if (callchain) { 490 if (self->use_callchain) {
489 if (!hit) 491 if (!hit)
490 callchain_init(&he->callchain); 492 callchain_init(&he->callchain);
491 append_chain(&he->callchain, chain, syms); 493 append_chain(&he->callchain, chain, syms);
@@ -495,7 +497,8 @@ static int hist_entry__add(struct addr_location *al,
495 return 0; 497 return 0;
496} 498}
497 499
498static size_t output__fprintf(FILE *fp, u64 total_samples) 500static size_t perf_session__fprintf_hist_entries(struct perf_session *self,
501 u64 total_samples, FILE *fp)
499{ 502{
500 struct hist_entry *pos; 503 struct hist_entry *pos;
501 struct sort_entry *se; 504 struct sort_entry *se;
@@ -567,9 +570,9 @@ static size_t output__fprintf(FILE *fp, u64 total_samples)
567 fprintf(fp, "#\n"); 570 fprintf(fp, "#\n");
568 571
569print_entries: 572print_entries:
570 for (nd = rb_first(&hist); nd; nd = rb_next(nd)) { 573 for (nd = rb_first(&self->hists); nd; nd = rb_next(nd)) {
571 pos = rb_entry(nd, struct hist_entry, rb_node); 574 pos = rb_entry(nd, struct hist_entry, rb_node);
572 ret += hist_entry__fprintf(fp, pos, total_samples); 575 ret += hist_entry__fprintf(fp, pos, self, total_samples);
573 } 576 }
574 577
575 if (sort_order == default_sort_order && 578 if (sort_order == default_sort_order &&
@@ -671,7 +674,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
671 if (sym_list && al.sym && !strlist__has_entry(sym_list, al.sym->name)) 674 if (sym_list && al.sym && !strlist__has_entry(sym_list, al.sym->name))
672 return 0; 675 return 0;
673 676
674 if (hist_entry__add(&al, session, data.callchain, data.period)) { 677 if (perf_session__add_hist_entry(session, &al, data.callchain, data.period)) {
675 pr_debug("problem incrementing symbol count, skipping event\n"); 678 pr_debug("problem incrementing symbol count, skipping event\n");
676 return -1; 679 return -1;
677 } 680 }
@@ -719,7 +722,7 @@ static int process_read_event(event_t *event, struct perf_session *session __use
719 return 0; 722 return 0;
720} 723}
721 724
722static int sample_type_check(u64 type) 725static int sample_type_check(u64 type, struct perf_session *session)
723{ 726{
724 sample_type = type; 727 sample_type = type;
725 728
@@ -730,14 +733,14 @@ static int sample_type_check(u64 type)
730 " perf record without -g?\n"); 733 " perf record without -g?\n");
731 return -1; 734 return -1;
732 } 735 }
733 if (callchain) { 736 if (session->use_callchain) {
734 fprintf(stderr, "selected -g but no callchain data." 737 fprintf(stderr, "selected -g but no callchain data."
735 " Did you call perf record without" 738 " Did you call perf record without"
736 " -g?\n"); 739 " -g?\n");
737 return -1; 740 return -1;
738 } 741 }
739 } else if (callchain_param.mode != CHAIN_NONE && !callchain) { 742 } else if (callchain_param.mode != CHAIN_NONE && !session->use_callchain) {
740 callchain = 1; 743 session->use_callchain = true;
741 if (register_callchain_param(&callchain_param) < 0) { 744 if (register_callchain_param(&callchain_param) < 0) {
742 fprintf(stderr, "Can't register callchain" 745 fprintf(stderr, "Can't register callchain"
743 " params\n"); 746 " params\n");
@@ -769,6 +772,8 @@ static int __cmd_report(void)
769 if (session == NULL) 772 if (session == NULL)
770 return -ENOMEM; 773 return -ENOMEM;
771 774
775 session->use_callchain = use_callchain;
776
772 if (show_threads) 777 if (show_threads)
773 perf_read_values_init(&show_threads_values); 778 perf_read_values_init(&show_threads_values);
774 779
@@ -787,9 +792,9 @@ static int __cmd_report(void)
787 if (verbose > 2) 792 if (verbose > 2)
788 dsos__fprintf(stdout); 793 dsos__fprintf(stdout);
789 794
790 collapse__resort(); 795 perf_session__collapse_resort(session);
791 output__resort(event__stats.total); 796 perf_session__output_resort(session, event__stats.total);
792 output__fprintf(stdout, event__stats.total); 797 perf_session__fprintf_hist_entries(session, event__stats.total, stdout);
793 798
794 if (show_threads) 799 if (show_threads)
795 perf_read_values_destroy(&show_threads_values); 800 perf_read_values_destroy(&show_threads_values);
@@ -805,7 +810,7 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
805 char *tok; 810 char *tok;
806 char *endptr; 811 char *endptr;
807 812
808 callchain = 1; 813 use_callchain = true;
809 814
810 if (!arg) 815 if (!arg)
811 return 0; 816 return 0;
@@ -826,7 +831,7 @@ parse_callchain_opt(const struct option *opt __used, const char *arg,
826 831
827 else if (!strncmp(tok, "none", strlen(arg))) { 832 else if (!strncmp(tok, "none", strlen(arg))) {
828 callchain_param.mode = CHAIN_NONE; 833 callchain_param.mode = CHAIN_NONE;
829 callchain = 0; 834 use_callchain = true;
830 835
831 return 0; 836 return 0;
832 } 837 }
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
index bce05dff6dfe..412ae924640a 100644
--- a/tools/perf/builtin-sched.c
+++ b/tools/perf/builtin-sched.c
@@ -1655,7 +1655,7 @@ static int process_lost_event(event_t *event __used,
1655 return 0; 1655 return 0;
1656} 1656}
1657 1657
1658static int sample_type_check(u64 type) 1658static int sample_type_check(u64 type, struct perf_session *session __used)
1659{ 1659{
1660 sample_type = type; 1660 sample_type = type;
1661 1661
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c
index 27018531404b..3a0a89e41523 100644
--- a/tools/perf/builtin-timechart.c
+++ b/tools/perf/builtin-timechart.c
@@ -1033,7 +1033,7 @@ static void process_samples(void)
1033 } 1033 }
1034} 1034}
1035 1035
1036static int sample_type_check(u64 type) 1036static int sample_type_check(u64 type, struct perf_session *session __used)
1037{ 1037{
1038 sample_type = type; 1038 sample_type = type;
1039 1039
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 9d89ae423ca5..adce442dd603 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -103,7 +103,7 @@ static int process_sample_event(event_t *event, struct perf_session *session)
103 return 0; 103 return 0;
104} 104}
105 105
106static int sample_type_check(u64 type) 106static int sample_type_check(u64 type, struct perf_session *session __used)
107{ 107{
108 sample_type = type; 108 sample_type = type;
109 109
diff --git a/tools/perf/util/data_map.c b/tools/perf/util/data_map.c
index 44dea211cc65..08c4cf5e66ba 100644
--- a/tools/perf/util/data_map.c
+++ b/tools/perf/util/data_map.c
@@ -161,7 +161,7 @@ int perf_session__process_events(struct perf_session *self,
161 161
162 err = -EINVAL; 162 err = -EINVAL;
163 if (ops->sample_type_check && 163 if (ops->sample_type_check &&
164 ops->sample_type_check(sample_type) < 0) 164 ops->sample_type_check(sample_type, self) < 0)
165 goto out_err; 165 goto out_err;
166 166
167 if (!ops->full_paths) { 167 if (!ops->full_paths) {
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index b40e37ded4bf..b9828fce7bf0 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -1,7 +1,6 @@
1#include "hist.h" 1#include "hist.h"
2 2#include "session.h"
3struct rb_root hist; 3#include "sort.h"
4int callchain;
5 4
6struct callchain_param callchain_param = { 5struct callchain_param callchain_param = {
7 .mode = CHAIN_GRAPH_REL, 6 .mode = CHAIN_GRAPH_REL,
@@ -12,11 +11,12 @@ struct callchain_param callchain_param = {
12 * histogram, sorted on item, collects counts 11 * histogram, sorted on item, collects counts
13 */ 12 */
14 13
15struct hist_entry *__hist_entry__add(struct addr_location *al, 14struct hist_entry *__perf_session__add_hist_entry(struct perf_session *self,
16 struct symbol *sym_parent, 15 struct addr_location *al,
17 u64 count, bool *hit) 16 struct symbol *sym_parent,
17 u64 count, bool *hit)
18{ 18{
19 struct rb_node **p = &hist.rb_node; 19 struct rb_node **p = &self->hists.rb_node;
20 struct rb_node *parent = NULL; 20 struct rb_node *parent = NULL;
21 struct hist_entry *he; 21 struct hist_entry *he;
22 struct hist_entry entry = { 22 struct hist_entry entry = {
@@ -52,7 +52,7 @@ struct hist_entry *__hist_entry__add(struct addr_location *al,
52 return NULL; 52 return NULL;
53 *he = entry; 53 *he = entry;
54 rb_link_node(&he->rb_node, parent, p); 54 rb_link_node(&he->rb_node, parent, p);
55 rb_insert_color(&he->rb_node, &hist); 55 rb_insert_color(&he->rb_node, &self->hists);
56 *hit = false; 56 *hit = false;
57 return he; 57 return he;
58} 58}
@@ -129,7 +129,7 @@ static void collapse__insert_entry(struct rb_root *root, struct hist_entry *he)
129 rb_insert_color(&he->rb_node, root); 129 rb_insert_color(&he->rb_node, root);
130} 130}
131 131
132void collapse__resort(void) 132void perf_session__collapse_resort(struct perf_session *self)
133{ 133{
134 struct rb_root tmp; 134 struct rb_root tmp;
135 struct rb_node *next; 135 struct rb_node *next;
@@ -139,31 +139,33 @@ void collapse__resort(void)
139 return; 139 return;
140 140
141 tmp = RB_ROOT; 141 tmp = RB_ROOT;
142 next = rb_first(&hist); 142 next = rb_first(&self->hists);
143 143
144 while (next) { 144 while (next) {
145 n = rb_entry(next, struct hist_entry, rb_node); 145 n = rb_entry(next, struct hist_entry, rb_node);
146 next = rb_next(&n->rb_node); 146 next = rb_next(&n->rb_node);
147 147
148 rb_erase(&n->rb_node, &hist); 148 rb_erase(&n->rb_node, &self->hists);
149 collapse__insert_entry(&tmp, n); 149 collapse__insert_entry(&tmp, n);
150 } 150 }
151 151
152 hist = tmp; 152 self->hists = tmp;
153} 153}
154 154
155/* 155/*
156 * reverse the map, sort on count. 156 * reverse the map, sort on count.
157 */ 157 */
158 158
159static void output__insert_entry(struct rb_root *root, struct hist_entry *he, 159static void perf_session__insert_output_hist_entry(struct perf_session *self,
160 u64 min_callchain_hits) 160 struct rb_root *root,
161 struct hist_entry *he,
162 u64 min_callchain_hits)
161{ 163{
162 struct rb_node **p = &root->rb_node; 164 struct rb_node **p = &root->rb_node;
163 struct rb_node *parent = NULL; 165 struct rb_node *parent = NULL;
164 struct hist_entry *iter; 166 struct hist_entry *iter;
165 167
166 if (callchain) 168 if (self->use_callchain)
167 callchain_param.sort(&he->sorted_chain, &he->callchain, 169 callchain_param.sort(&he->sorted_chain, &he->callchain,
168 min_callchain_hits, &callchain_param); 170 min_callchain_hits, &callchain_param);
169 171
@@ -181,7 +183,7 @@ static void output__insert_entry(struct rb_root *root, struct hist_entry *he,
181 rb_insert_color(&he->rb_node, root); 183 rb_insert_color(&he->rb_node, root);
182} 184}
183 185
184void output__resort(u64 total_samples) 186void perf_session__output_resort(struct perf_session *self, u64 total_samples)
185{ 187{
186 struct rb_root tmp; 188 struct rb_root tmp;
187 struct rb_node *next; 189 struct rb_node *next;
@@ -192,15 +194,16 @@ void output__resort(u64 total_samples)
192 total_samples * (callchain_param.min_percent / 100); 194 total_samples * (callchain_param.min_percent / 100);
193 195
194 tmp = RB_ROOT; 196 tmp = RB_ROOT;
195 next = rb_first(&hist); 197 next = rb_first(&self->hists);
196 198
197 while (next) { 199 while (next) {
198 n = rb_entry(next, struct hist_entry, rb_node); 200 n = rb_entry(next, struct hist_entry, rb_node);
199 next = rb_next(&n->rb_node); 201 next = rb_next(&n->rb_node);
200 202
201 rb_erase(&n->rb_node, &hist); 203 rb_erase(&n->rb_node, &self->hists);
202 output__insert_entry(&tmp, n, min_callchain_hits); 204 perf_session__insert_output_hist_entry(self, &tmp, n,
205 min_callchain_hits);
203 } 206 }
204 207
205 hist = tmp; 208 self->hists = tmp;
206} 209}
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h
index a6cb1485e3b9..7efdb1b6d8c8 100644
--- a/tools/perf/util/hist.h
+++ b/tools/perf/util/hist.h
@@ -1,40 +1,25 @@
1#ifndef __PERF_HIST_H 1#ifndef __PERF_HIST_H
2#define __PERF_HIST_H 2#define __PERF_HIST_H
3#include "../builtin.h"
4 3
5#include "util.h" 4#include <linux/types.h>
6
7#include "color.h"
8#include <linux/list.h>
9#include "cache.h"
10#include <linux/rbtree.h>
11#include "symbol.h"
12#include "string.h"
13#include "callchain.h" 5#include "callchain.h"
14#include "strlist.h"
15#include "values.h"
16
17#include "../perf.h"
18#include "debug.h"
19#include "header.h"
20
21#include "parse-options.h"
22#include "parse-events.h"
23 6
24#include "thread.h"
25#include "sort.h"
26
27extern struct rb_root hist;
28extern int callchain;
29extern struct callchain_param callchain_param; 7extern struct callchain_param callchain_param;
30 8
31struct hist_entry *__hist_entry__add(struct addr_location *al, 9struct perf_session;
32 struct symbol *parent, 10struct hist_entry;
33 u64 count, bool *hit); 11struct addr_location;
12struct symbol;
13
14struct hist_entry *__perf_session__add_hist_entry(struct perf_session *self,
15 struct addr_location *al,
16 struct symbol *parent,
17 u64 count, bool *hit);
34extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *); 18extern int64_t hist_entry__cmp(struct hist_entry *, struct hist_entry *);
35extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *); 19extern int64_t hist_entry__collapse(struct hist_entry *, struct hist_entry *);
36extern void hist_entry__free(struct hist_entry *); 20void hist_entry__free(struct hist_entry *);
37extern void collapse__resort(void); 21
38extern void output__resort(u64); 22void perf_session__output_resort(struct perf_session *self, u64 total_samples);
23void perf_session__collapse_resort(struct perf_session *self);
39 24
40#endif /* __PERF_HIST_H */ 25#endif /* __PERF_HIST_H */
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h
index 20b2c9cc834b..759d96022a39 100644
--- a/tools/perf/util/session.h
+++ b/tools/perf/util/session.h
@@ -16,10 +16,12 @@ struct perf_session {
16 struct map_groups kmaps; 16 struct map_groups kmaps;
17 struct rb_root threads; 17 struct rb_root threads;
18 struct thread *last_match; 18 struct thread *last_match;
19 struct rb_root hists;
19 int fd; 20 int fd;
20 int cwdlen; 21 int cwdlen;
21 char *cwd; 22 char *cwd;
22 bool use_modules; 23 bool use_modules;
24 bool use_callchain;
23 char filename[0]; 25 char filename[0];
24}; 26};
25 27
@@ -35,7 +37,8 @@ struct perf_event_ops {
35 event_op process_read_event; 37 event_op process_read_event;
36 event_op process_throttle_event; 38 event_op process_throttle_event;
37 event_op process_unthrottle_event; 39 event_op process_unthrottle_event;
38 int (*sample_type_check)(u64 sample_type); 40 int (*sample_type_check)(u64 sample_type,
41 struct perf_session *session);
39 unsigned long total_unknown; 42 unsigned long total_unknown;
40 bool full_paths; 43 bool full_paths;
41}; 44};