2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-17 09:43:59 +08:00

perf/urgent fixes:

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>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCXcGdpgAKCRCyPKLppCJ+
 JwoXAQDeac29fMxv3fHcmkxjQnt5M0f3GV14+bT8qmUZhDgi0QD8DzVpa1iKF+cC
 N26yDNU0zcj6Rs6WUWlBgyXfvrS4JQs=
 =fbXe
 -----END PGP SIGNATURE-----

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>
This commit is contained in:
Thomas Gleixner 2019-11-06 19:10:41 +01:00
commit 485c053513
5 changed files with 14 additions and 38 deletions

View File

@ -1625,7 +1625,7 @@ int hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
return 0; return 0;
} }
static int hist_entry__sort(struct hist_entry *a, struct hist_entry *b) static int64_t hist_entry__sort(struct hist_entry *a, struct hist_entry *b)
{ {
struct hists *hists = a->hists; struct hists *hists = a->hists;
struct perf_hpp_fmt *fmt; struct perf_hpp_fmt *fmt;

View File

@ -539,10 +539,11 @@ static int perl_stop_script(void)
static int perl_generate_script(struct tep_handle *pevent, const char *outfile) static int perl_generate_script(struct tep_handle *pevent, const char *outfile)
{ {
int i, not_first, count, nr_events;
struct tep_event **all_events;
struct tep_event *event = NULL; struct tep_event *event = NULL;
struct tep_format_field *f; struct tep_format_field *f;
char fname[PATH_MAX]; char fname[PATH_MAX];
int not_first, count;
FILE *ofp; FILE *ofp;
sprintf(fname, "%s.pl", outfile); sprintf(fname, "%s.pl", outfile);
@ -603,8 +604,11 @@ sub print_backtrace\n\
}\n\n\ }\n\n\
"); ");
nr_events = tep_get_events_count(pevent);
all_events = tep_list_events(pevent, TEP_EVENT_SORT_ID);
while ((event = trace_find_next_event(pevent, event))) { for (i = 0; all_events && i < nr_events; i++) {
event = all_events[i];
fprintf(ofp, "sub %s::%s\n{\n", event->system, event->name); fprintf(ofp, "sub %s::%s\n{\n", event->system, event->name);
fprintf(ofp, "\tmy ("); fprintf(ofp, "\tmy (");

View File

@ -1687,10 +1687,11 @@ static int python_stop_script(void)
static int python_generate_script(struct tep_handle *pevent, const char *outfile) static int python_generate_script(struct tep_handle *pevent, const char *outfile)
{ {
int i, not_first, count, nr_events;
struct tep_event **all_events;
struct tep_event *event = NULL; struct tep_event *event = NULL;
struct tep_format_field *f; struct tep_format_field *f;
char fname[PATH_MAX]; char fname[PATH_MAX];
int not_first, count;
FILE *ofp; FILE *ofp;
sprintf(fname, "%s.py", outfile); sprintf(fname, "%s.py", outfile);
@ -1735,7 +1736,11 @@ static int python_generate_script(struct tep_handle *pevent, const char *outfile
fprintf(ofp, "def trace_end():\n"); fprintf(ofp, "def trace_end():\n");
fprintf(ofp, "\tprint(\"in trace_end\")\n\n"); fprintf(ofp, "\tprint(\"in trace_end\")\n\n");
while ((event = trace_find_next_event(pevent, event))) { nr_events = tep_get_events_count(pevent);
all_events = tep_list_events(pevent, TEP_EVENT_SORT_ID);
for (i = 0; all_events && i < nr_events; i++) {
event = all_events[i];
fprintf(ofp, "def %s__%s(", event->system, event->name); fprintf(ofp, "def %s__%s(", event->system, event->name);
fprintf(ofp, "event_name, "); fprintf(ofp, "event_name, ");
fprintf(ofp, "context, "); fprintf(ofp, "context, ");

View File

@ -173,37 +173,6 @@ int parse_event_file(struct tep_handle *pevent,
return tep_parse_event(pevent, buf, size, sys); return tep_parse_event(pevent, buf, size, sys);
} }
struct tep_event *trace_find_next_event(struct tep_handle *pevent,
struct tep_event *event)
{
static int idx;
int events_count;
struct tep_event *all_events;
all_events = tep_get_first_event(pevent);
events_count = tep_get_events_count(pevent);
if (!pevent || !all_events || events_count < 1)
return NULL;
if (!event) {
idx = 0;
return all_events;
}
if (idx < events_count && event == (all_events + idx)) {
idx++;
if (idx == events_count)
return NULL;
return (all_events + idx);
}
for (idx = 1; idx < events_count; idx++) {
if (event == (all_events + (idx - 1)))
return (all_events + idx);
}
return NULL;
}
struct flag { struct flag {
const char *name; const char *name;
unsigned long long value; unsigned long long value;

View File

@ -47,8 +47,6 @@ void parse_saved_cmdline(struct tep_handle *pevent, char *file, unsigned int siz
ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe); ssize_t trace_report(int fd, struct trace_event *tevent, bool repipe);
struct tep_event *trace_find_next_event(struct tep_handle *pevent,
struct tep_event *event);
unsigned long long read_size(struct tep_event *event, void *ptr, int size); unsigned long long read_size(struct tep_event *event, void *ptr, int size);
unsigned long long eval_flag(const char *flag); unsigned long long eval_flag(const char *flag);