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

Commit 9486aa38 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

perf tools: Fix 64 bit integer format strings



Using %L[uxd] has issues in some architectures, like on ppc64.  Fix it
by making our 64 bit integers typedefs of stdint.h types and using
PRI[ux]64 like, for instance, git does.

Reported by Denis Kirjanov that provided a patch for one case, I went
and changed all cases.

Reported-by: default avatarDenis Kirjanov <dkirjanov@kernel.org>
Tested-by: default avatarDenis Kirjanov <dkirjanov@kernel.org>
LKML-Reference: <20110120093246.GA8031@hera.kernel.org>
Cc: Denis Kirjanov <dkirjanov@kernel.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Pingtian Han <phan@redhat.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Tom Zanussi <tzanussi@gmail.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 57b84e53
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -212,7 +212,7 @@ get_source_line(struct hist_entry *he, int len, const char *filename)
			continue;
			continue;


		offset = start + i;
		offset = start + i;
		sprintf(cmd, "addr2line -e %s %016llx", filename, offset);
		sprintf(cmd, "addr2line -e %s %016" PRIx64, filename, offset);
		fp = popen(cmd, "r");
		fp = popen(cmd, "r");
		if (!fp)
		if (!fp)
			continue;
			continue;
@@ -270,9 +270,9 @@ static void hist_entry__print_hits(struct hist_entry *self)


	for (offset = 0; offset < len; ++offset)
	for (offset = 0; offset < len; ++offset)
		if (h->ip[offset] != 0)
		if (h->ip[offset] != 0)
			printf("%*Lx: %Lu\n", BITS_PER_LONG / 2,
			printf("%*" PRIx64 ": %" PRIu64 "\n", BITS_PER_LONG / 2,
			       sym->start + offset, h->ip[offset]);
			       sym->start + offset, h->ip[offset]);
	printf("%*s: %Lu\n", BITS_PER_LONG / 2, "h->sum", h->sum);
	printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum);
}
}


static int hist_entry__tty_annotate(struct hist_entry *he)
static int hist_entry__tty_annotate(struct hist_entry *he)
+2 −2
Original line number Original line Diff line number Diff line
@@ -371,10 +371,10 @@ static void __print_result(struct rb_root *root, struct perf_session *session,
			addr = data->ptr;
			addr = data->ptr;


		if (sym != NULL)
		if (sym != NULL)
			snprintf(buf, sizeof(buf), "%s+%Lx", sym->name,
			snprintf(buf, sizeof(buf), "%s+%" PRIx64 "", sym->name,
				 addr - map->unmap_ip(map, sym->start));
				 addr - map->unmap_ip(map, sym->start));
		else
		else
			snprintf(buf, sizeof(buf), "%#Lx", addr);
			snprintf(buf, sizeof(buf), "%#" PRIx64 "", addr);
		printf(" %-34s |", buf);
		printf(" %-34s |", buf);


		printf(" %9llu/%-5lu | %9llu/%-5lu | %8lu | %8lu | %6.3f%%\n",
		printf(" %9llu/%-5lu | %9llu/%-5lu | %8lu | %8lu | %6.3f%%\n",
+3 −3
Original line number Original line Diff line number Diff line
@@ -782,9 +782,9 @@ static void print_result(void)
		pr_info("%10u ", st->nr_acquired);
		pr_info("%10u ", st->nr_acquired);
		pr_info("%10u ", st->nr_contended);
		pr_info("%10u ", st->nr_contended);


		pr_info("%15llu ", st->wait_time_total);
		pr_info("%15" PRIu64 " ", st->wait_time_total);
		pr_info("%15llu ", st->wait_time_max);
		pr_info("%15" PRIu64 " ", st->wait_time_max);
		pr_info("%15llu ", st->wait_time_min == ULLONG_MAX ?
		pr_info("%15" PRIu64 " ", st->wait_time_min == ULLONG_MAX ?
		       0 : st->wait_time_min);
		       0 : st->wait_time_min);
		pr_info("\n");
		pr_info("\n");
	}
	}
+1 −1
Original line number Original line Diff line number Diff line
@@ -817,7 +817,7 @@ static int __cmd_record(int argc, const char **argv)
	 * Approximate RIP event size: 24 bytes.
	 * Approximate RIP event size: 24 bytes.
	 */
	 */
	fprintf(stderr,
	fprintf(stderr,
		"[ perf record: Captured and wrote %.3f MB %s (~%lld samples) ]\n",
		"[ perf record: Captured and wrote %.3f MB %s (~%" PRIu64 " samples) ]\n",
		(double)bytes_written / 1024.0 / 1024.0,
		(double)bytes_written / 1024.0 / 1024.0,
		output_name,
		output_name,
		bytes_written / 24);
		bytes_written / 24);
+1 −1
Original line number Original line Diff line number Diff line
@@ -197,7 +197,7 @@ static int process_read_event(event_t *event, struct sample_data *sample __used,
					   event->read.value);
					   event->read.value);
	}
	}


	dump_printf(": %d %d %s %Lu\n", event->read.pid, event->read.tid,
	dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid,
		    attr ? __event_name(attr->type, attr->config) : "FAIL",
		    attr ? __event_name(attr->type, attr->config) : "FAIL",
		    event->read.value);
		    event->read.value);


Loading