Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'perf-urgent-for-mingo-5.4-20191105' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent

Pull perf fixes from Arnaldo Carvalho de Melo:

perf report/top:

Jiri Olsa:

- Fix time sorting for big numbers, i.e.:

perf report -s time -F time,overhead --stdio

was failing because the sort comparision routine was returning 'int' while
that particular -s key was int64_t, fix it.

perf scripting engines:

Steven Rostedt (VMware):

- Iterate on tep event arrays directly, fixing a bug when generating python/perl
source code from a perf.data file with more than one tracepoint event.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+14 -38
+1 -1
tools/perf/util/hist.c
··· 1625 1625 return 0; 1626 1626 } 1627 1627 1628 - static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b) 1628 + static int64_t hist_entry__sort(struct hist_entry *a, struct hist_entry *b) 1629 1629 { 1630 1630 struct hists *hists = a->hists; 1631 1631 struct perf_hpp_fmt *fmt;
+6 -2
tools/perf/util/scripting-engines/trace-event-perl.c
··· 539 539 540 540 static int perl_generate_script(struct tep_handle *pevent, const char *outfile) 541 541 { 542 + int i, not_first, count, nr_events; 543 + struct tep_event **all_events; 542 544 struct tep_event *event = NULL; 543 545 struct tep_format_field *f; 544 546 char fname[PATH_MAX]; 545 - int not_first, count; 546 547 FILE *ofp; 547 548 548 549 sprintf(fname, "%s.pl", outfile); ··· 604 603 }\n\n\ 605 604 "); 606 605 606 + nr_events = tep_get_events_count(pevent); 607 + all_events = tep_list_events(pevent, TEP_EVENT_SORT_ID); 607 608 608 - while ((event = trace_find_next_event(pevent, event))) { 609 + for (i = 0; all_events && i < nr_events; i++) { 610 + event = all_events[i]; 609 611 fprintf(ofp, "sub %s::%s\n{\n", event->system, event->name); 610 612 fprintf(ofp, "\tmy ("); 611 613
+7 -2
tools/perf/util/scripting-engines/trace-event-python.c
··· 1687 1687 1688 1688 static int python_generate_script(struct tep_handle *pevent, const char *outfile) 1689 1689 { 1690 + int i, not_first, count, nr_events; 1691 + struct tep_event **all_events; 1690 1692 struct tep_event *event = NULL; 1691 1693 struct tep_format_field *f; 1692 1694 char fname[PATH_MAX]; 1693 - int not_first, count; 1694 1695 FILE *ofp; 1695 1696 1696 1697 sprintf(fname, "%s.py", outfile); ··· 1736 1735 fprintf(ofp, "def trace_end():\n"); 1737 1736 fprintf(ofp, "\tprint(\"in trace_end\")\n\n"); 1738 1737 1739 - while ((event = trace_find_next_event(pevent, event))) { 1738 + nr_events = tep_get_events_count(pevent); 1739 + all_events = tep_list_events(pevent, TEP_EVENT_SORT_ID); 1740 + 1741 + for (i = 0; all_events && i < nr_events; i++) { 1742 + event = all_events[i]; 1740 1743 fprintf(ofp, "def %s__%s(", event->system, event->name); 1741 1744 fprintf(ofp, "event_name, "); 1742 1745 fprintf(ofp, "context, ");
-31
tools/perf/util/trace-event-parse.c
··· 173 173 return tep_parse_event(pevent, buf, size, sys); 174 174 } 175 175 176 - struct tep_event *trace_find_next_event(struct tep_handle *pevent, 177 - struct tep_event *event) 178 - { 179 - static int idx; 180 - int events_count; 181 - struct tep_event *all_events; 182 - 183 - all_events = tep_get_first_event(pevent); 184 - events_count = tep_get_events_count(pevent); 185 - if (!pevent || !all_events || events_count < 1) 186 - return NULL; 187 - 188 - if (!event) { 189 - idx = 0; 190 - return all_events; 191 - } 192 - 193 - if (idx < events_count && event == (all_events + idx)) { 194 - idx++; 195 - if (idx == events_count) 196 - return NULL; 197 - return (all_events + idx); 198 - } 199 - 200 - for (idx = 1; idx < events_count; idx++) { 201 - if (event == (all_events + (idx - 1))) 202 - return (all_events + idx); 203 - } 204 - return NULL; 205 - } 206 - 207 176 struct flag { 208 177 const char *name; 209 178 unsigned long long value;
-2
tools/perf/util/trace-event.h
··· 47 47 48 48 ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe); 49 49 50 - struct tep_event *trace_find_next_event(struct tep_handle *pevent, 51 - struct tep_event *event); 52 50 unsigned long long read_size(struct tep_event *event, void *ptr, int size); 53 51 unsigned long long eval_flag(const char *flag); 54 52