Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b584a176 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull perf tooling fixes from Thomas Gleixner:

 - Fix the time sorting algorithm which was broken due to truncation of
   big numbers

 - Fix the python script generator fail caused by a broken tracepoint
   array iterator

* 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  perf tools: Fix time sorting
  perf tools: Remove unused trace_find_next_event()
  perf scripting engines: Iterate on tep event arrays directly
parents ffba65ea 485c0535
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1625,7 +1625,7 @@ int hists__collapse_resort(struct hists *hists, struct ui_progress *prog)
	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 perf_hpp_fmt *fmt;
+6 −2
Original line number Diff line number Diff line
@@ -539,10 +539,11 @@ static int perl_stop_script(void)

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_format_field *f;
	char fname[PATH_MAX];
	int not_first, count;
	FILE *ofp;

	sprintf(fname, "%s.pl", outfile);
@@ -603,8 +604,11 @@ sub print_backtrace\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, "\tmy (");

+7 −2
Original line number Diff line number Diff line
@@ -1687,10 +1687,11 @@ static int python_stop_script(void)

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_format_field *f;
	char fname[PATH_MAX];
	int not_first, count;
	FILE *ofp;

	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, "\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, "event_name, ");
		fprintf(ofp, "context, ");
+0 −31
Original line number Diff line number Diff line
@@ -173,37 +173,6 @@ int parse_event_file(struct tep_handle *pevent,
	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 {
	const char *name;
	unsigned long long value;
+0 −2
Original line number Diff line number Diff line
@@ -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);

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 eval_flag(const char *flag);