diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-22 17:37:02 -0500 |
|---|---|---|
| committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-01-22 20:41:57 -0500 |
| commit | 9486aa38771661e96fbb51c549b9901b5df609d8 (patch) | |
| tree | 72cecbff0cb5124c960feeec3a6ac1fff75c649a /tools/perf/util | |
| parent | 57b84e53171ce672683faf1cab2e660965a6bdaf (diff) | |
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: Denis Kirjanov <dkirjanov@kernel.org>
Tested-by: Denis 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: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util')
| -rw-r--r-- | tools/perf/util/event.c | 5 | ||||
| -rw-r--r-- | tools/perf/util/header.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/hist.c | 17 | ||||
| -rw-r--r-- | tools/perf/util/map.c | 3 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/probe-event.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/session.c | 28 | ||||
| -rw-r--r-- | tools/perf/util/svghelper.c | 5 | ||||
| -rw-r--r-- | tools/perf/util/symbol.c | 9 | ||||
| -rw-r--r-- | tools/perf/util/types.h | 10 | ||||
| -rw-r--r-- | tools/perf/util/ui/browsers/hists.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/ui/browsers/map.c | 5 | ||||
| -rw-r--r-- | tools/perf/util/values.c | 10 |
13 files changed, 56 insertions, 46 deletions
diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 2302ec051bb4..1478ab4ee222 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c | |||
| @@ -459,7 +459,8 @@ int event__process_comm(event_t *self, struct sample_data *sample __used, | |||
| 459 | int event__process_lost(event_t *self, struct sample_data *sample __used, | 459 | int event__process_lost(event_t *self, struct sample_data *sample __used, |
| 460 | struct perf_session *session) | 460 | struct perf_session *session) |
| 461 | { | 461 | { |
| 462 | dump_printf(": id:%Ld: lost:%Ld\n", self->lost.id, self->lost.lost); | 462 | dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n", |
| 463 | self->lost.id, self->lost.lost); | ||
| 463 | session->hists.stats.total_lost += self->lost.lost; | 464 | session->hists.stats.total_lost += self->lost.lost; |
| 464 | return 0; | 465 | return 0; |
| 465 | } | 466 | } |
| @@ -575,7 +576,7 @@ int event__process_mmap(event_t *self, struct sample_data *sample __used, | |||
| 575 | u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; | 576 | u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; |
| 576 | int ret = 0; | 577 | int ret = 0; |
| 577 | 578 | ||
| 578 | dump_printf(" %d/%d: [%#Lx(%#Lx) @ %#Lx]: %s\n", | 579 | dump_printf(" %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %s\n", |
| 579 | self->mmap.pid, self->mmap.tid, self->mmap.start, | 580 | self->mmap.pid, self->mmap.tid, self->mmap.start, |
| 580 | self->mmap.len, self->mmap.pgoff, self->mmap.filename); | 581 | self->mmap.len, self->mmap.pgoff, self->mmap.filename); |
| 581 | 582 | ||
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 989fa2dee2fd..f6a929e74981 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
| @@ -798,8 +798,8 @@ static int perf_file_section__process(struct perf_file_section *self, | |||
| 798 | int feat, int fd) | 798 | int feat, int fd) |
| 799 | { | 799 | { |
| 800 | if (lseek(fd, self->offset, SEEK_SET) == (off_t)-1) { | 800 | if (lseek(fd, self->offset, SEEK_SET) == (off_t)-1) { |
| 801 | pr_debug("Failed to lseek to %Ld offset for feature %d, " | 801 | pr_debug("Failed to lseek to %" PRIu64 " offset for feature " |
| 802 | "continuing...\n", self->offset, feat); | 802 | "%d, continuing...\n", self->offset, feat); |
| 803 | return 0; | 803 | return 0; |
| 804 | } | 804 | } |
| 805 | 805 | ||
diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index c749ba6136a0..32f4f1f2f6e4 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c | |||
| @@ -636,13 +636,13 @@ int hist_entry__snprintf(struct hist_entry *self, char *s, size_t size, | |||
| 636 | } | 636 | } |
| 637 | } | 637 | } |
| 638 | } else | 638 | } else |
| 639 | ret = snprintf(s, size, sep ? "%lld" : "%12lld ", period); | 639 | ret = snprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period); |
| 640 | 640 | ||
| 641 | if (symbol_conf.show_nr_samples) { | 641 | if (symbol_conf.show_nr_samples) { |
| 642 | if (sep) | 642 | if (sep) |
| 643 | ret += snprintf(s + ret, size - ret, "%c%lld", *sep, period); | 643 | ret += snprintf(s + ret, size - ret, "%c%" PRIu64, *sep, period); |
| 644 | else | 644 | else |
| 645 | ret += snprintf(s + ret, size - ret, "%11lld", period); | 645 | ret += snprintf(s + ret, size - ret, "%11" PRIu64, period); |
| 646 | } | 646 | } |
| 647 | 647 | ||
| 648 | if (pair_hists) { | 648 | if (pair_hists) { |
| @@ -971,7 +971,7 @@ int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip) | |||
| 971 | sym_size = sym->end - sym->start; | 971 | sym_size = sym->end - sym->start; |
| 972 | offset = ip - sym->start; | 972 | offset = ip - sym->start; |
| 973 | 973 | ||
| 974 | pr_debug3("%s: ip=%#Lx\n", __func__, self->ms.map->unmap_ip(self->ms.map, ip)); | 974 | pr_debug3("%s: ip=%#" PRIx64 "\n", __func__, self->ms.map->unmap_ip(self->ms.map, ip)); |
| 975 | 975 | ||
| 976 | if (offset >= sym_size) | 976 | if (offset >= sym_size) |
| 977 | return 0; | 977 | return 0; |
| @@ -980,8 +980,9 @@ int hist_entry__inc_addr_samples(struct hist_entry *self, u64 ip) | |||
| 980 | h->sum++; | 980 | h->sum++; |
| 981 | h->ip[offset]++; | 981 | h->ip[offset]++; |
| 982 | 982 | ||
| 983 | pr_debug3("%#Lx %s: period++ [ip: %#Lx, %#Lx] => %Ld\n", self->ms.sym->start, | 983 | pr_debug3("%#" PRIx64 " %s: period++ [ip: %#" PRIx64 ", %#" PRIx64 |
| 984 | self->ms.sym->name, ip, ip - self->ms.sym->start, h->ip[offset]); | 984 | "] => %" PRIu64 "\n", self->ms.sym->start, self->ms.sym->name, |
| 985 | ip, ip - self->ms.sym->start, h->ip[offset]); | ||
| 985 | return 0; | 986 | return 0; |
| 986 | } | 987 | } |
| 987 | 988 | ||
| @@ -1132,7 +1133,7 @@ fallback: | |||
| 1132 | goto out_free_filename; | 1133 | goto out_free_filename; |
| 1133 | } | 1134 | } |
| 1134 | 1135 | ||
| 1135 | pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__, | 1136 | pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, |
| 1136 | filename, sym->name, map->unmap_ip(map, sym->start), | 1137 | filename, sym->name, map->unmap_ip(map, sym->start), |
| 1137 | map->unmap_ip(map, sym->end)); | 1138 | map->unmap_ip(map, sym->end)); |
| 1138 | 1139 | ||
| @@ -1142,7 +1143,7 @@ fallback: | |||
| 1142 | dso, dso->long_name, sym, sym->name); | 1143 | dso, dso->long_name, sym, sym->name); |
| 1143 | 1144 | ||
| 1144 | snprintf(command, sizeof(command), | 1145 | snprintf(command, sizeof(command), |
| 1145 | "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS -C %s|grep -v %s|expand", | 1146 | "objdump --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -dS -C %s|grep -v %s|expand", |
| 1146 | map__rip_2objdump(map, sym->start), | 1147 | map__rip_2objdump(map, sym->start), |
| 1147 | map__rip_2objdump(map, sym->end), | 1148 | map__rip_2objdump(map, sym->end), |
| 1148 | symfs_filename, filename); | 1149 | symfs_filename, filename); |
diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c index 3a7eb6ec0eec..a16ecab5229d 100644 --- a/tools/perf/util/map.c +++ b/tools/perf/util/map.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "symbol.h" | 1 | #include "symbol.h" |
| 2 | #include <errno.h> | 2 | #include <errno.h> |
| 3 | #include <inttypes.h> | ||
| 3 | #include <limits.h> | 4 | #include <limits.h> |
| 4 | #include <stdlib.h> | 5 | #include <stdlib.h> |
| 5 | #include <string.h> | 6 | #include <string.h> |
| @@ -195,7 +196,7 @@ int map__overlap(struct map *l, struct map *r) | |||
| 195 | 196 | ||
| 196 | size_t map__fprintf(struct map *self, FILE *fp) | 197 | size_t map__fprintf(struct map *self, FILE *fp) |
| 197 | { | 198 | { |
| 198 | return fprintf(fp, " %Lx-%Lx %Lx %s\n", | 199 | return fprintf(fp, " %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s\n", |
| 199 | self->start, self->end, self->pgoff, self->dso->name); | 200 | self->start, self->end, self->pgoff, self->dso->name); |
| 200 | } | 201 | } |
| 201 | 202 | ||
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index bc2732ee23eb..135f69baf966 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -279,7 +279,7 @@ const char *__event_name(int type, u64 config) | |||
| 279 | static char buf[32]; | 279 | static char buf[32]; |
| 280 | 280 | ||
| 281 | if (type == PERF_TYPE_RAW) { | 281 | if (type == PERF_TYPE_RAW) { |
| 282 | sprintf(buf, "raw 0x%llx", config); | 282 | sprintf(buf, "raw 0x%" PRIx64, config); |
| 283 | return buf; | 283 | return buf; |
| 284 | } | 284 | } |
| 285 | 285 | ||
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 128aaab0aeda..6e29d9c9dccc 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
| @@ -172,7 +172,7 @@ static int kprobe_convert_to_perf_probe(struct probe_trace_point *tp, | |||
| 172 | sym = __find_kernel_function_by_name(tp->symbol, &map); | 172 | sym = __find_kernel_function_by_name(tp->symbol, &map); |
| 173 | if (sym) { | 173 | if (sym) { |
| 174 | addr = map->unmap_ip(map, sym->start + tp->offset); | 174 | addr = map->unmap_ip(map, sym->start + tp->offset); |
| 175 | pr_debug("try to find %s+%ld@%llx\n", tp->symbol, | 175 | pr_debug("try to find %s+%ld@%" PRIx64 "\n", tp->symbol, |
| 176 | tp->offset, addr); | 176 | tp->offset, addr); |
| 177 | ret = find_perf_probe_point((unsigned long)addr, pp); | 177 | ret = find_perf_probe_point((unsigned long)addr, pp); |
| 178 | } | 178 | } |
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index 313dac2d94ce..105f00bfd555 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
| @@ -652,10 +652,11 @@ static void callchain__printf(struct sample_data *sample) | |||
| 652 | { | 652 | { |
| 653 | unsigned int i; | 653 | unsigned int i; |
| 654 | 654 | ||
| 655 | printf("... chain: nr:%Lu\n", sample->callchain->nr); | 655 | printf("... chain: nr:%" PRIu64 "\n", sample->callchain->nr); |
| 656 | 656 | ||
| 657 | for (i = 0; i < sample->callchain->nr; i++) | 657 | for (i = 0; i < sample->callchain->nr; i++) |
| 658 | printf("..... %2d: %016Lx\n", i, sample->callchain->ips[i]); | 658 | printf("..... %2d: %016" PRIx64 "\n", |
| 659 | i, sample->callchain->ips[i]); | ||
| 659 | } | 660 | } |
| 660 | 661 | ||
| 661 | static void perf_session__print_tstamp(struct perf_session *session, | 662 | static void perf_session__print_tstamp(struct perf_session *session, |
| @@ -672,7 +673,7 @@ static void perf_session__print_tstamp(struct perf_session *session, | |||
| 672 | printf("%u ", sample->cpu); | 673 | printf("%u ", sample->cpu); |
| 673 | 674 | ||
| 674 | if (session->sample_type & PERF_SAMPLE_TIME) | 675 | if (session->sample_type & PERF_SAMPLE_TIME) |
| 675 | printf("%Lu ", sample->time); | 676 | printf("%" PRIu64 " ", sample->time); |
| 676 | } | 677 | } |
| 677 | 678 | ||
| 678 | static void dump_event(struct perf_session *session, event_t *event, | 679 | static void dump_event(struct perf_session *session, event_t *event, |
| @@ -681,16 +682,16 @@ static void dump_event(struct perf_session *session, event_t *event, | |||
| 681 | if (!dump_trace) | 682 | if (!dump_trace) |
| 682 | return; | 683 | return; |
| 683 | 684 | ||
| 684 | printf("\n%#Lx [%#x]: event: %d\n", file_offset, event->header.size, | 685 | printf("\n%#" PRIx64 " [%#x]: event: %d\n", |
| 685 | event->header.type); | 686 | file_offset, event->header.size, event->header.type); |
| 686 | 687 | ||
| 687 | trace_event(event); | 688 | trace_event(event); |
| 688 | 689 | ||
| 689 | if (sample) | 690 | if (sample) |
| 690 | perf_session__print_tstamp(session, event, sample); | 691 | perf_session__print_tstamp(session, event, sample); |
| 691 | 692 | ||
| 692 | printf("%#Lx [%#x]: PERF_RECORD_%s", file_offset, event->header.size, | 693 | printf("%#" PRIx64 " [%#x]: PERF_RECORD_%s", file_offset, |
| 693 | event__get_event_name(event->header.type)); | 694 | event->header.size, event__get_event_name(event->header.type)); |
| 694 | } | 695 | } |
| 695 | 696 | ||
| 696 | static void dump_sample(struct perf_session *session, event_t *event, | 697 | static void dump_sample(struct perf_session *session, event_t *event, |
| @@ -699,8 +700,9 @@ static void dump_sample(struct perf_session *session, event_t *event, | |||
| 699 | if (!dump_trace) | 700 | if (!dump_trace) |
| 700 | return; | 701 | return; |
| 701 | 702 | ||
| 702 | printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc, | 703 | printf("(IP, %d): %d/%d: %#" PRIx64 " period: %" PRIu64 "\n", |
| 703 | sample->pid, sample->tid, sample->ip, sample->period); | 704 | event->header.misc, sample->pid, sample->tid, sample->ip, |
| 705 | sample->period); | ||
| 704 | 706 | ||
| 705 | if (session->sample_type & PERF_SAMPLE_CALLCHAIN) | 707 | if (session->sample_type & PERF_SAMPLE_CALLCHAIN) |
| 706 | callchain__printf(sample); | 708 | callchain__printf(sample); |
| @@ -843,8 +845,8 @@ static void perf_session__warn_about_errors(const struct perf_session *session, | |||
| 843 | { | 845 | { |
| 844 | if (ops->lost == event__process_lost && | 846 | if (ops->lost == event__process_lost && |
| 845 | session->hists.stats.total_lost != 0) { | 847 | session->hists.stats.total_lost != 0) { |
| 846 | ui__warning("Processed %Lu events and LOST %Lu!\n\n" | 848 | ui__warning("Processed %" PRIu64 " events and LOST %" PRIu64 |
| 847 | "Check IO/CPU overload!\n\n", | 849 | "!\n\nCheck IO/CPU overload!\n\n", |
| 848 | session->hists.stats.total_period, | 850 | session->hists.stats.total_period, |
| 849 | session->hists.stats.total_lost); | 851 | session->hists.stats.total_lost); |
| 850 | } | 852 | } |
| @@ -918,7 +920,7 @@ more: | |||
| 918 | 920 | ||
| 919 | if (size == 0 || | 921 | if (size == 0 || |
| 920 | (skip = perf_session__process_event(self, &event, ops, head)) < 0) { | 922 | (skip = perf_session__process_event(self, &event, ops, head)) < 0) { |
| 921 | dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n", | 923 | dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n", |
| 922 | head, event.header.size, event.header.type); | 924 | head, event.header.size, event.header.type); |
| 923 | /* | 925 | /* |
| 924 | * assume we lost track of the stream, check alignment, and | 926 | * assume we lost track of the stream, check alignment, and |
| @@ -1023,7 +1025,7 @@ more: | |||
| 1023 | 1025 | ||
| 1024 | if (size == 0 || | 1026 | if (size == 0 || |
| 1025 | perf_session__process_event(session, event, ops, file_pos) < 0) { | 1027 | perf_session__process_event(session, event, ops, file_pos) < 0) { |
| 1026 | dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n", | 1028 | dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n", |
| 1027 | file_offset + head, event->header.size, | 1029 | file_offset + head, event->header.size, |
| 1028 | event->header.type); | 1030 | event->header.type); |
| 1029 | /* | 1031 | /* |
diff --git a/tools/perf/util/svghelper.c b/tools/perf/util/svghelper.c index b3637db025a2..805220afc083 100644 --- a/tools/perf/util/svghelper.c +++ b/tools/perf/util/svghelper.c | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | * of the License. | 12 | * of the License. |
| 13 | */ | 13 | */ |
| 14 | 14 | ||
| 15 | #include <inttypes.h> | ||
| 15 | #include <stdio.h> | 16 | #include <stdio.h> |
| 16 | #include <stdlib.h> | 17 | #include <stdlib.h> |
| 17 | #include <unistd.h> | 18 | #include <unistd.h> |
| @@ -94,7 +95,7 @@ void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end) | |||
| 94 | 95 | ||
| 95 | total_height = (1 + rows + cpu2slot(cpus)) * SLOT_MULT; | 96 | total_height = (1 + rows + cpu2slot(cpus)) * SLOT_MULT; |
| 96 | fprintf(svgfile, "<?xml version=\"1.0\" standalone=\"no\"?> \n"); | 97 | fprintf(svgfile, "<?xml version=\"1.0\" standalone=\"no\"?> \n"); |
| 97 | fprintf(svgfile, "<svg width=\"%i\" height=\"%llu\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height); | 98 | fprintf(svgfile, "<svg width=\"%i\" height=\"%" PRIu64 "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height); |
| 98 | 99 | ||
| 99 | fprintf(svgfile, "<defs>\n <style type=\"text/css\">\n <![CDATA[\n"); | 100 | fprintf(svgfile, "<defs>\n <style type=\"text/css\">\n <![CDATA[\n"); |
| 100 | 101 | ||
| @@ -483,7 +484,7 @@ void svg_time_grid(void) | |||
| 483 | color = 128; | 484 | color = 128; |
| 484 | } | 485 | } |
| 485 | 486 | ||
| 486 | fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%llu\" style=\"stroke:rgb(%i,%i,%i);stroke-width:%1.3f\"/>\n", | 487 | fprintf(svgfile, "<line x1=\"%4.8f\" y1=\"%4.2f\" x2=\"%4.8f\" y2=\"%" PRIu64 "\" style=\"stroke:rgb(%i,%i,%i);stroke-width:%1.3f\"/>\n", |
| 487 | time2pixels(i), SLOT_MULT/2, time2pixels(i), total_height, color, color, color, thickness); | 488 | time2pixels(i), SLOT_MULT/2, time2pixels(i), total_height, color, color, color, thickness); |
| 488 | 489 | ||
| 489 | i += 10000000; | 490 | i += 10000000; |
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c index e32478effed8..7821d0e6866f 100644 --- a/tools/perf/util/symbol.c +++ b/tools/perf/util/symbol.c | |||
| @@ -11,6 +11,7 @@ | |||
| 11 | #include <sys/param.h> | 11 | #include <sys/param.h> |
| 12 | #include <fcntl.h> | 12 | #include <fcntl.h> |
| 13 | #include <unistd.h> | 13 | #include <unistd.h> |
| 14 | #include <inttypes.h> | ||
| 14 | #include "build-id.h" | 15 | #include "build-id.h" |
| 15 | #include "debug.h" | 16 | #include "debug.h" |
| 16 | #include "symbol.h" | 17 | #include "symbol.h" |
| @@ -153,7 +154,7 @@ static struct symbol *symbol__new(u64 start, u64 len, u8 binding, | |||
| 153 | self->binding = binding; | 154 | self->binding = binding; |
| 154 | self->namelen = namelen - 1; | 155 | self->namelen = namelen - 1; |
| 155 | 156 | ||
| 156 | pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end); | 157 | pr_debug4("%s: %s %#" PRIx64 "-%#" PRIx64 "\n", __func__, name, start, self->end); |
| 157 | 158 | ||
| 158 | memcpy(self->name, name, namelen); | 159 | memcpy(self->name, name, namelen); |
| 159 | 160 | ||
| @@ -167,7 +168,7 @@ void symbol__delete(struct symbol *self) | |||
| 167 | 168 | ||
| 168 | static size_t symbol__fprintf(struct symbol *self, FILE *fp) | 169 | static size_t symbol__fprintf(struct symbol *self, FILE *fp) |
| 169 | { | 170 | { |
| 170 | return fprintf(fp, " %llx-%llx %c %s\n", | 171 | return fprintf(fp, " %" PRIx64 "-%" PRIx64 " %c %s\n", |
| 171 | self->start, self->end, | 172 | self->start, self->end, |
| 172 | self->binding == STB_GLOBAL ? 'g' : | 173 | self->binding == STB_GLOBAL ? 'g' : |
| 173 | self->binding == STB_LOCAL ? 'l' : 'w', | 174 | self->binding == STB_LOCAL ? 'l' : 'w', |
| @@ -1215,8 +1216,8 @@ static int dso__load_sym(struct dso *self, struct map *map, const char *name, | |||
| 1215 | } | 1216 | } |
| 1216 | 1217 | ||
| 1217 | if (curr_dso->adjust_symbols) { | 1218 | if (curr_dso->adjust_symbols) { |
| 1218 | pr_debug4("%s: adjusting symbol: st_value: %#Lx " | 1219 | pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " |
| 1219 | "sh_addr: %#Lx sh_offset: %#Lx\n", __func__, | 1220 | "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", __func__, |
| 1220 | (u64)sym.st_value, (u64)shdr.sh_addr, | 1221 | (u64)sym.st_value, (u64)shdr.sh_addr, |
| 1221 | (u64)shdr.sh_offset); | 1222 | (u64)shdr.sh_offset); |
| 1222 | sym.st_value -= shdr.sh_addr - shdr.sh_offset; | 1223 | sym.st_value -= shdr.sh_addr - shdr.sh_offset; |
diff --git a/tools/perf/util/types.h b/tools/perf/util/types.h index 7d6b8331f898..5f3689a3d085 100644 --- a/tools/perf/util/types.h +++ b/tools/perf/util/types.h | |||
| @@ -1,12 +1,14 @@ | |||
| 1 | #ifndef __PERF_TYPES_H | 1 | #ifndef __PERF_TYPES_H |
| 2 | #define __PERF_TYPES_H | 2 | #define __PERF_TYPES_H |
| 3 | 3 | ||
| 4 | #include <stdint.h> | ||
| 5 | |||
| 4 | /* | 6 | /* |
| 5 | * We define u64 as unsigned long long for every architecture | 7 | * We define u64 as uint64_t for every architecture |
| 6 | * so that we can print it with %Lx without getting warnings. | 8 | * so that we can print it with "%"PRIx64 without getting warnings. |
| 7 | */ | 9 | */ |
| 8 | typedef unsigned long long u64; | 10 | typedef uint64_t u64; |
| 9 | typedef signed long long s64; | 11 | typedef int64_t s64; |
| 10 | typedef unsigned int u32; | 12 | typedef unsigned int u32; |
| 11 | typedef signed int s32; | 13 | typedef signed int s32; |
| 12 | typedef unsigned short u16; | 14 | typedef unsigned short u16; |
diff --git a/tools/perf/util/ui/browsers/hists.c b/tools/perf/util/ui/browsers/hists.c index ebda8c3fde9e..60c463c16028 100644 --- a/tools/perf/util/ui/browsers/hists.c +++ b/tools/perf/util/ui/browsers/hists.c | |||
| @@ -350,7 +350,7 @@ static char *callchain_list__sym_name(struct callchain_list *self, | |||
| 350 | if (self->ms.sym) | 350 | if (self->ms.sym) |
| 351 | return self->ms.sym->name; | 351 | return self->ms.sym->name; |
| 352 | 352 | ||
| 353 | snprintf(bf, bfsize, "%#Lx", self->ip); | 353 | snprintf(bf, bfsize, "%#" PRIx64, self->ip); |
| 354 | return bf; | 354 | return bf; |
| 355 | } | 355 | } |
| 356 | 356 | ||
diff --git a/tools/perf/util/ui/browsers/map.c b/tools/perf/util/ui/browsers/map.c index e35437dfa5b4..e5158369106e 100644 --- a/tools/perf/util/ui/browsers/map.c +++ b/tools/perf/util/ui/browsers/map.c | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | #include "../libslang.h" | 1 | #include "../libslang.h" |
| 2 | #include <elf.h> | 2 | #include <elf.h> |
| 3 | #include <inttypes.h> | ||
| 3 | #include <sys/ttydefaults.h> | 4 | #include <sys/ttydefaults.h> |
| 4 | #include <ctype.h> | 5 | #include <ctype.h> |
| 5 | #include <string.h> | 6 | #include <string.h> |
| @@ -57,7 +58,7 @@ static void map_browser__write(struct ui_browser *self, void *nd, int row) | |||
| 57 | int width; | 58 | int width; |
| 58 | 59 | ||
| 59 | ui_browser__set_percent_color(self, 0, current_entry); | 60 | ui_browser__set_percent_color(self, 0, current_entry); |
| 60 | slsmg_printf("%*llx %*llx %c ", | 61 | slsmg_printf("%*" PRIx64 " %*" PRIx64 " %c ", |
| 61 | mb->addrlen, sym->start, mb->addrlen, sym->end, | 62 | mb->addrlen, sym->start, mb->addrlen, sym->end, |
| 62 | sym->binding == STB_GLOBAL ? 'g' : | 63 | sym->binding == STB_GLOBAL ? 'g' : |
| 63 | sym->binding == STB_LOCAL ? 'l' : 'w'); | 64 | sym->binding == STB_LOCAL ? 'l' : 'w'); |
| @@ -150,6 +151,6 @@ int map__browse(struct map *self) | |||
| 150 | ++mb.b.nr_entries; | 151 | ++mb.b.nr_entries; |
| 151 | } | 152 | } |
| 152 | 153 | ||
| 153 | mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr); | 154 | mb.addrlen = snprintf(tmp, sizeof(tmp), "%" PRIx64, maxaddr); |
| 154 | return map_browser__run(&mb); | 155 | return map_browser__run(&mb); |
| 155 | } | 156 | } |
diff --git a/tools/perf/util/values.c b/tools/perf/util/values.c index cfa55d686e3b..bdd33470b235 100644 --- a/tools/perf/util/values.c +++ b/tools/perf/util/values.c | |||
| @@ -150,7 +150,7 @@ static void perf_read_values__display_pretty(FILE *fp, | |||
| 150 | if (width > tidwidth) | 150 | if (width > tidwidth) |
| 151 | tidwidth = width; | 151 | tidwidth = width; |
| 152 | for (j = 0; j < values->counters; j++) { | 152 | for (j = 0; j < values->counters; j++) { |
| 153 | width = snprintf(NULL, 0, "%Lu", values->value[i][j]); | 153 | width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]); |
| 154 | if (width > counterwidth[j]) | 154 | if (width > counterwidth[j]) |
| 155 | counterwidth[j] = width; | 155 | counterwidth[j] = width; |
| 156 | } | 156 | } |
| @@ -165,7 +165,7 @@ static void perf_read_values__display_pretty(FILE *fp, | |||
| 165 | fprintf(fp, " %*d %*d", pidwidth, values->pid[i], | 165 | fprintf(fp, " %*d %*d", pidwidth, values->pid[i], |
| 166 | tidwidth, values->tid[i]); | 166 | tidwidth, values->tid[i]); |
| 167 | for (j = 0; j < values->counters; j++) | 167 | for (j = 0; j < values->counters; j++) |
| 168 | fprintf(fp, " %*Lu", | 168 | fprintf(fp, " %*" PRIu64, |
| 169 | counterwidth[j], values->value[i][j]); | 169 | counterwidth[j], values->value[i][j]); |
| 170 | fprintf(fp, "\n"); | 170 | fprintf(fp, "\n"); |
| 171 | } | 171 | } |
| @@ -196,13 +196,13 @@ static void perf_read_values__display_raw(FILE *fp, | |||
| 196 | width = strlen(values->countername[j]); | 196 | width = strlen(values->countername[j]); |
| 197 | if (width > namewidth) | 197 | if (width > namewidth) |
| 198 | namewidth = width; | 198 | namewidth = width; |
| 199 | width = snprintf(NULL, 0, "%llx", values->counterrawid[j]); | 199 | width = snprintf(NULL, 0, "%" PRIx64, values->counterrawid[j]); |
| 200 | if (width > rawwidth) | 200 | if (width > rawwidth) |
| 201 | rawwidth = width; | 201 | rawwidth = width; |
| 202 | } | 202 | } |
| 203 | for (i = 0; i < values->threads; i++) { | 203 | for (i = 0; i < values->threads; i++) { |
| 204 | for (j = 0; j < values->counters; j++) { | 204 | for (j = 0; j < values->counters; j++) { |
| 205 | width = snprintf(NULL, 0, "%Lu", values->value[i][j]); | 205 | width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]); |
| 206 | if (width > countwidth) | 206 | if (width > countwidth) |
| 207 | countwidth = width; | 207 | countwidth = width; |
| 208 | } | 208 | } |
| @@ -214,7 +214,7 @@ static void perf_read_values__display_raw(FILE *fp, | |||
| 214 | countwidth, "Count"); | 214 | countwidth, "Count"); |
| 215 | for (i = 0; i < values->threads; i++) | 215 | for (i = 0; i < values->threads; i++) |
| 216 | for (j = 0; j < values->counters; j++) | 216 | for (j = 0; j < values->counters; j++) |
| 217 | fprintf(fp, " %*d %*d %*s %*llx %*Lu\n", | 217 | fprintf(fp, " %*d %*d %*s %*" PRIx64 " %*" PRIu64, |
| 218 | pidwidth, values->pid[i], | 218 | pidwidth, values->pid[i], |
| 219 | tidwidth, values->tid[i], | 219 | tidwidth, values->tid[i], |
| 220 | namewidth, values->countername[j], | 220 | namewidth, values->countername[j], |
