diff options
Diffstat (limited to 'tools/perf/util')
-rw-r--r-- | tools/perf/util/event.c | 2 | ||||
-rw-r--r-- | tools/perf/util/hist.c | 20 | ||||
-rw-r--r-- | tools/perf/util/hist.h | 16 | ||||
-rw-r--r-- | tools/perf/util/newt.c | 6 | ||||
-rw-r--r-- | tools/perf/util/session.c | 2 |
5 files changed, 29 insertions, 17 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 3e8fec173041..50771b5813ee 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
@@ -385,7 +385,7 @@ int event__process_comm(event_t *self, struct perf_session *session) | |||
385 | int event__process_lost(event_t *self, struct perf_session *session) | 385 | int event__process_lost(event_t *self, struct perf_session *session) |
386 | { | 386 | { |
387 | dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost); | 387 | dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost); |
388 | session->hists.stats.lost += self->lost.lost; | 388 | session->hists.stats.total_lost += self->lost.lost; |
389 | return 0; | 389 | return 0; |
390 | } | 390 | } |
391 | 391 | ||
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 1614ad710046..c59224518083 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
@@ -239,7 +239,7 @@ void hists__output_resort(struct hists *self) | |||
239 | struct hist_entry *n; | 239 | struct hist_entry *n; |
240 | u64 min_callchain_hits; | 240 | u64 min_callchain_hits; |
241 | 241 | ||
242 | min_callchain_hits = self->stats.total * (callchain_param.min_percent / 100); | 242 | min_callchain_hits = self->stats.total_period * (callchain_param.min_percent / 100); |
243 | 243 | ||
244 | tmp = RB_ROOT; | 244 | tmp = RB_ROOT; |
245 | next = rb_first(&self->entries); | 245 | next = rb_first(&self->entries); |
@@ -525,7 +525,7 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
525 | 525 | ||
526 | if (pair_hists) { | 526 | if (pair_hists) { |
527 | count = self->pair ? self->pair->count : 0; | 527 | count = self->pair ? self->pair->count : 0; |
528 | total = pair_hists->stats.total; | 528 | total = pair_hists->stats.total_period; |
529 | count_sys = self->pair ? self->pair->count_sys : 0; | 529 | count_sys = self->pair ? self->pair->count_sys : 0; |
530 | count_us = self->pair ? self->pair->count_us : 0; | 530 | count_us = self->pair ? self->pair->count_us : 0; |
531 | count_guest_sys = self->pair ? self->pair->count_guest_sys : 0; | 531 | count_guest_sys = self->pair ? self->pair->count_guest_sys : 0; |
@@ -769,10 +769,10 @@ print_entries: | |||
769 | ++position; | 769 | ++position; |
770 | } | 770 | } |
771 | ret += hist_entry__fprintf(h, pair, show_displacement, | 771 | ret += hist_entry__fprintf(h, pair, show_displacement, |
772 | displacement, fp, self->stats.total); | 772 | displacement, fp, self->stats.total_period); |
773 | 773 | ||
774 | if (symbol_conf.use_callchain) | 774 | if (symbol_conf.use_callchain) |
775 | ret += hist_entry__fprintf_callchain(h, fp, self->stats.total); | 775 | ret += hist_entry__fprintf_callchain(h, fp, self->stats.total_period); |
776 | 776 | ||
777 | if (h->ms.map == NULL && verbose > 1) { | 777 | if (h->ms.map == NULL && verbose > 1) { |
778 | __map_groups__fprintf_maps(&h->thread->mg, | 778 | __map_groups__fprintf_maps(&h->thread->mg, |
@@ -795,7 +795,7 @@ void hists__filter_by_dso(struct hists *self, const struct dso *dso) | |||
795 | { | 795 | { |
796 | struct rb_node *nd; | 796 | struct rb_node *nd; |
797 | 797 | ||
798 | self->nr_entries = self->stats.total = 0; | 798 | self->nr_entries = self->stats.total_period = 0; |
799 | self->max_sym_namelen = 0; | 799 | self->max_sym_namelen = 0; |
800 | 800 | ||
801 | for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) { | 801 | for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) { |
@@ -812,7 +812,7 @@ void hists__filter_by_dso(struct hists *self, const struct dso *dso) | |||
812 | h->filtered &= ~(1 << HIST_FILTER__DSO); | 812 | h->filtered &= ~(1 << HIST_FILTER__DSO); |
813 | if (!h->filtered) { | 813 | if (!h->filtered) { |
814 | ++self->nr_entries; | 814 | ++self->nr_entries; |
815 | self->stats.total += h->count; | 815 | self->stats.total_period += h->count; |
816 | if (h->ms.sym && | 816 | if (h->ms.sym && |
817 | self->max_sym_namelen < h->ms.sym->namelen) | 817 | self->max_sym_namelen < h->ms.sym->namelen) |
818 | self->max_sym_namelen = h->ms.sym->namelen; | 818 | self->max_sym_namelen = h->ms.sym->namelen; |
@@ -824,7 +824,7 @@ void hists__filter_by_thread(struct hists *self, const struct thread *thread) | |||
824 | { | 824 | { |
825 | struct rb_node *nd; | 825 | struct rb_node *nd; |
826 | 826 | ||
827 | self->nr_entries = self->stats.total = 0; | 827 | self->nr_entries = self->stats.total_period = 0; |
828 | self->max_sym_namelen = 0; | 828 | self->max_sym_namelen = 0; |
829 | 829 | ||
830 | for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) { | 830 | for (nd = rb_first(&self->entries); nd; nd = rb_next(nd)) { |
@@ -837,7 +837,7 @@ void hists__filter_by_thread(struct hists *self, const struct thread *thread) | |||
837 | h->filtered &= ~(1 << HIST_FILTER__THREAD); | 837 | h->filtered &= ~(1 << HIST_FILTER__THREAD); |
838 | if (!h->filtered) { | 838 | if (!h->filtered) { |
839 | ++self->nr_entries; | 839 | ++self->nr_entries; |
840 | self->stats.total += h->count; | 840 | self->stats.total_period += h->count; |
841 | if (h->ms.sym && | 841 | if (h->ms.sym && |
842 | self->max_sym_namelen < h->ms.sym->namelen) | 842 | self->max_sym_namelen < h->ms.sym->namelen) |
843 | self->max_sym_namelen = h->ms.sym->namelen; | 843 | self->max_sym_namelen = h->ms.sym->namelen; |
@@ -1031,8 +1031,8 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head) | |||
1031 | 1031 | ||
1032 | void hists__inc_nr_events(struct hists *self, u32 type) | 1032 | void hists__inc_nr_events(struct hists *self, u32 type) |
1033 | { | 1033 | { |
1034 | ++self->hists.stats.nr_events[0]; | 1034 | ++self->stats.nr_events[0]; |
1035 | ++self->hists.stats.nr_events[type]; | 1035 | ++self->stats.nr_events[type]; |
1036 | } | 1036 | } |
1037 | 1037 | ||
1038 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp) | 1038 | size_t hists__fprintf_nr_events(struct hists *self, FILE *fp) |
diff --git a/tools/perf/util/hist.h b/tools/perf/util/hist.h index 97b8962ff69a..da6b84814a50 100644 --- a/tools/perf/util/hist.h +++ b/tools/perf/util/hist.h | |||
@@ -37,9 +37,21 @@ struct sym_priv { | |||
37 | struct sym_ext *ext; | 37 | struct sym_ext *ext; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | /* | ||
41 | * The kernel collects the number of events it couldn't send in a stretch and | ||
42 | * when possible sends this number in a PERF_RECORD_LOST event. The number of | ||
43 | * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while | ||
44 | * total_lost tells exactly how many events the kernel in fact lost, i.e. it is | ||
45 | * the sum of all struct lost_event.lost fields reported. | ||
46 | * | ||
47 | * The total_period is needed because by default auto-freq is used, so | ||
48 | * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get | ||
49 | * the total number of low level events, it is necessary to to sum all struct | ||
50 | * sample_event.period and stash the result in total_period. | ||
51 | */ | ||
40 | struct events_stats { | 52 | struct events_stats { |
41 | u64 total; | 53 | u64 total_period; |
42 | u64 lost; | 54 | u64 total_lost; |
43 | u32 nr_events[PERF_RECORD_HEADER_MAX]; | 55 | u32 nr_events[PERF_RECORD_HEADER_MAX]; |
44 | u32 nr_unknown_events; | 56 | u32 nr_unknown_events; |
45 | }; | 57 | }; |
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index ba6acd04c082..010bacf40163 100644 --- a/tools/perf/util/newt.c +++ b/tools/perf/util/newt.c | |||
@@ -689,7 +689,7 @@ static int hist_browser__populate(struct hist_browser *self, struct hists *hists | |||
689 | } | 689 | } |
690 | 690 | ||
691 | snprintf(str, sizeof(str), "Samples: %Ld ", | 691 | snprintf(str, sizeof(str), "Samples: %Ld ", |
692 | hists->stats.total); | 692 | hists->stats.total_period); |
693 | newtDrawRootText(0, 0, str); | 693 | newtDrawRootText(0, 0, str); |
694 | 694 | ||
695 | newtGetScreenSize(NULL, &rows); | 695 | newtGetScreenSize(NULL, &rows); |
@@ -718,12 +718,12 @@ static int hist_browser__populate(struct hist_browser *self, struct hists *hists | |||
718 | if (h->filtered) | 718 | if (h->filtered) |
719 | continue; | 719 | continue; |
720 | 720 | ||
721 | len = hist_entry__append_browser(h, self->tree, hists->stats.total); | 721 | len = hist_entry__append_browser(h, self->tree, hists->stats.total_period); |
722 | if (len > max_len) | 722 | if (len > max_len) |
723 | max_len = len; | 723 | max_len = len; |
724 | if (symbol_conf.use_callchain) | 724 | if (symbol_conf.use_callchain) |
725 | hist_entry__append_callchain_browser(h, self->tree, | 725 | hist_entry__append_callchain_browser(h, self->tree, |
726 | hists->stats.total, idx++); | 726 | hists->stats.total_period, idx++); |
727 | ++curr_hist; | 727 | ++curr_hist; |
728 | if (curr_hist % 5) | 728 | if (curr_hist % 5) |
729 | ui_progress__update(progress, curr_hist); | 729 | ui_progress__update(progress, curr_hist); |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 7231f6b19fb4..25bfca4f10f0 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -549,7 +549,7 @@ static int perf_session__process_event(struct perf_session *self, | |||
549 | dump_printf("%#Lx [%#x]: PERF_RECORD_%s", | 549 | dump_printf("%#Lx [%#x]: PERF_RECORD_%s", |
550 | offset + head, event->header.size, | 550 | offset + head, event->header.size, |
551 | event__name[event->header.type]); | 551 | event__name[event->header.type]); |
552 | hists__inc_nr_events(self, event->header.type); | 552 | hists__inc_nr_events(&self->hists, event->header.type); |
553 | } | 553 | } |
554 | 554 | ||
555 | if (self->header.needs_swap && event__swap_ops[event->header.type]) | 555 | if (self->header.needs_swap && event__swap_ops[event->header.type]) |