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

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>

+93 -82
+3 -3
tools/perf/builtin-annotate.c
··· 212 212 continue; 213 213 214 214 offset = start + i; 215 - sprintf(cmd, "addr2line -e %s %016llx", filename, offset); 215 + sprintf(cmd, "addr2line -e %s %016" PRIx64, filename, offset); 216 216 fp = popen(cmd, "r"); 217 217 if (!fp) 218 218 continue; ··· 270 270 271 271 for (offset = 0; offset < len; ++offset) 272 272 if (h->ip[offset] != 0) 273 - printf("%*Lx: %Lu\n", BITS_PER_LONG / 2, 273 + printf("%*" PRIx64 ": %" PRIu64 "\n", BITS_PER_LONG / 2, 274 274 sym->start + offset, h->ip[offset]); 275 - printf("%*s: %Lu\n", BITS_PER_LONG / 2, "h->sum", h->sum); 275 + printf("%*s: %" PRIu64 "\n", BITS_PER_LONG / 2, "h->sum", h->sum); 276 276 } 277 277 278 278 static int hist_entry__tty_annotate(struct hist_entry *he)
+2 -2
tools/perf/builtin-kmem.c
··· 371 371 addr = data->ptr; 372 372 373 373 if (sym != NULL) 374 - snprintf(buf, sizeof(buf), "%s+%Lx", sym->name, 374 + snprintf(buf, sizeof(buf), "%s+%" PRIx64 "", sym->name, 375 375 addr - map->unmap_ip(map, sym->start)); 376 376 else 377 - snprintf(buf, sizeof(buf), "%#Lx", addr); 377 + snprintf(buf, sizeof(buf), "%#" PRIx64 "", addr); 378 378 printf(" %-34s |", buf); 379 379 380 380 printf(" %9llu/%-5lu | %9llu/%-5lu | %8lu | %8lu | %6.3f%%\n",
+3 -3
tools/perf/builtin-lock.c
··· 782 782 pr_info("%10u ", st->nr_acquired); 783 783 pr_info("%10u ", st->nr_contended); 784 784 785 - pr_info("%15llu ", st->wait_time_total); 786 - pr_info("%15llu ", st->wait_time_max); 787 - pr_info("%15llu ", st->wait_time_min == ULLONG_MAX ? 785 + pr_info("%15" PRIu64 " ", st->wait_time_total); 786 + pr_info("%15" PRIu64 " ", st->wait_time_max); 787 + pr_info("%15" PRIu64 " ", st->wait_time_min == ULLONG_MAX ? 788 788 0 : st->wait_time_min); 789 789 pr_info("\n"); 790 790 }
+1 -1
tools/perf/builtin-record.c
··· 817 817 * Approximate RIP event size: 24 bytes. 818 818 */ 819 819 fprintf(stderr, 820 - "[ perf record: Captured and wrote %.3f MB %s (~%lld samples) ]\n", 820 + "[ perf record: Captured and wrote %.3f MB %s (~%" PRIu64 " samples) ]\n", 821 821 (double)bytes_written / 1024.0 / 1024.0, 822 822 output_name, 823 823 bytes_written / 24);
+1 -1
tools/perf/builtin-report.c
··· 197 197 event->read.value); 198 198 } 199 199 200 - dump_printf(": %d %d %s %Lu\n", event->read.pid, event->read.tid, 200 + dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid, 201 201 attr ? __event_name(attr->type, attr->config) : "FAIL", 202 202 event->read.value); 203 203
+10 -10
tools/perf/builtin-sched.c
··· 193 193 } 194 194 run_measurement_overhead = min_delta; 195 195 196 - printf("run measurement overhead: %Ld nsecs\n", min_delta); 196 + printf("run measurement overhead: %" PRIu64 " nsecs\n", min_delta); 197 197 } 198 198 199 199 static void calibrate_sleep_measurement_overhead(void) ··· 211 211 min_delta -= 10000; 212 212 sleep_measurement_overhead = min_delta; 213 213 214 - printf("sleep measurement overhead: %Ld nsecs\n", min_delta); 214 + printf("sleep measurement overhead: %" PRIu64 " nsecs\n", min_delta); 215 215 } 216 216 217 217 static struct sched_atom * ··· 617 617 burn_nsecs(1e6); 618 618 T1 = get_nsecs(); 619 619 620 - printf("the run test took %Ld nsecs\n", T1-T0); 620 + printf("the run test took %" PRIu64 " nsecs\n", T1 - T0); 621 621 622 622 T0 = get_nsecs(); 623 623 sleep_nsecs(1e6); 624 624 T1 = get_nsecs(); 625 625 626 - printf("the sleep test took %Ld nsecs\n", T1-T0); 626 + printf("the sleep test took %" PRIu64 " nsecs\n", T1 - T0); 627 627 } 628 628 629 629 #define FILL_FIELD(ptr, field, event, data) \ ··· 816 816 delta = 0; 817 817 818 818 if (delta < 0) 819 - die("hm, delta: %Ld < 0 ?\n", delta); 819 + die("hm, delta: %" PRIu64 " < 0 ?\n", delta); 820 820 821 821 if (verbose) { 822 - printf(" ... switch from %s/%d to %s/%d [ran %Ld nsecs]\n", 822 + printf(" ... switch from %s/%d to %s/%d [ran %" PRIu64 " nsecs]\n", 823 823 switch_event->prev_comm, switch_event->prev_pid, 824 824 switch_event->next_comm, switch_event->next_pid, 825 825 delta); ··· 1048 1048 delta = 0; 1049 1049 1050 1050 if (delta < 0) 1051 - die("hm, delta: %Ld < 0 ?\n", delta); 1051 + die("hm, delta: %" PRIu64 " < 0 ?\n", delta); 1052 1052 1053 1053 1054 1054 sched_out = perf_session__findnew(session, switch_event->prev_pid); ··· 1221 1221 1222 1222 avg = work_list->total_lat / work_list->nb_atoms; 1223 1223 1224 - printf("|%11.3f ms |%9llu | avg:%9.3f ms | max:%9.3f ms | max at: %9.6f s\n", 1224 + printf("|%11.3f ms |%9" PRIu64 " | avg:%9.3f ms | max:%9.3f ms | max at: %9.6f s\n", 1225 1225 (double)work_list->total_runtime / 1e6, 1226 1226 work_list->nb_atoms, (double)avg / 1e6, 1227 1227 (double)work_list->max_lat / 1e6, ··· 1423 1423 delta = 0; 1424 1424 1425 1425 if (delta < 0) 1426 - die("hm, delta: %Ld < 0 ?\n", delta); 1426 + die("hm, delta: %" PRIu64 " < 0 ?\n", delta); 1427 1427 1428 1428 1429 1429 sched_out = perf_session__findnew(session, switch_event->prev_pid); ··· 1713 1713 } 1714 1714 1715 1715 printf(" -----------------------------------------------------------------------------------------\n"); 1716 - printf(" TOTAL: |%11.3f ms |%9Ld |\n", 1716 + printf(" TOTAL: |%11.3f ms |%9" PRIu64 " |\n", 1717 1717 (double)all_runtime/1e6, all_count); 1718 1718 1719 1719 printf(" ---------------------------------------------------\n");
+3 -3
tools/perf/builtin-script.c
··· 77 77 if (session->sample_type & PERF_SAMPLE_RAW) { 78 78 if (debug_mode) { 79 79 if (sample->time < last_timestamp) { 80 - pr_err("Samples misordered, previous: %llu " 81 - "this: %llu\n", last_timestamp, 80 + pr_err("Samples misordered, previous: %" PRIu64 81 + " this: %" PRIu64 "\n", last_timestamp, 82 82 sample->time); 83 83 nr_unordered++; 84 84 } ··· 126 126 ret = perf_session__process_events(session, &event_ops); 127 127 128 128 if (debug_mode) 129 - pr_err("Misordered timestamps: %llu\n", nr_unordered); 129 + pr_err("Misordered timestamps: %" PRIu64 "\n", nr_unordered); 130 130 131 131 return ret; 132 132 }
+2 -2
tools/perf/builtin-stat.c
··· 206 206 update_stats(&ps->res_stats[i], count[i]); 207 207 208 208 if (verbose) { 209 - fprintf(stderr, "%s: %Ld %Ld %Ld\n", event_name(counter), 210 - count[0], count[1], count[2]); 209 + fprintf(stderr, "%s: %" PRIu64 " %" PRIu64 " %" PRIu64 "\n", 210 + event_name(counter), count[0], count[1], count[2]); 211 211 } 212 212 213 213 /*
+7 -7
tools/perf/builtin-test.c
··· 146 146 if (llabs(skew) < page_size) 147 147 continue; 148 148 149 - pr_debug("%#Lx: diff end addr for %s v: %#Lx k: %#Lx\n", 149 + pr_debug("%#" PRIx64 ": diff end addr for %s v: %#" PRIx64 " k: %#" PRIx64 "\n", 150 150 sym->start, sym->name, sym->end, pair->end); 151 151 } else { 152 152 struct rb_node *nnd; ··· 168 168 goto detour; 169 169 } 170 170 171 - pr_debug("%#Lx: diff name v: %s k: %s\n", 171 + pr_debug("%#" PRIx64 ": diff name v: %s k: %s\n", 172 172 sym->start, sym->name, pair->name); 173 173 } 174 174 } else 175 - pr_debug("%#Lx: %s not on kallsyms\n", sym->start, sym->name); 175 + pr_debug("%#" PRIx64 ": %s not on kallsyms\n", sym->start, sym->name); 176 176 177 177 err = -1; 178 178 } ··· 211 211 212 212 if (pair->start == pos->start) { 213 213 pair->priv = 1; 214 - pr_info(" %Lx-%Lx %Lx %s in kallsyms as", 214 + pr_info(" %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s in kallsyms as", 215 215 pos->start, pos->end, pos->pgoff, pos->dso->name); 216 216 if (pos->pgoff != pair->pgoff || pos->end != pair->end) 217 - pr_info(": \n*%Lx-%Lx %Lx", 217 + pr_info(": \n*%" PRIx64 "-%" PRIx64 " %" PRIx64 "", 218 218 pair->start, pair->end, pair->pgoff); 219 219 pr_info(" %s\n", pair->dso->name); 220 220 pair->priv = 1; ··· 307 307 } 308 308 309 309 if (evsel->counts->cpu[0].val != nr_open_calls) { 310 - pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %Ld\n", 310 + pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls, got %" PRIu64 "\n", 311 311 nr_open_calls, evsel->counts->cpu[0].val); 312 312 goto out_close_fd; 313 313 } ··· 421 421 422 422 expected = nr_open_calls + cpu; 423 423 if (evsel->counts->cpu[cpu].val != expected) { 424 - pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %Ld\n", 424 + pr_debug("perf_evsel__read_on_cpu: expected to intercept %d calls on cpu %d, got %" PRIu64 "\n", 425 425 expected, cpus->map[cpu], evsel->counts->cpu[cpu].val); 426 426 goto out_close_fd; 427 427 }
+5 -4
tools/perf/builtin-top.c
··· 40 40 #include <stdio.h> 41 41 #include <termios.h> 42 42 #include <unistd.h> 43 + #include <inttypes.h> 43 44 44 45 #include <errno.h> 45 46 #include <time.h> ··· 215 214 len = sym->end - sym->start; 216 215 217 216 sprintf(command, 218 - "objdump --start-address=%#0*Lx --stop-address=%#0*Lx -dS %s", 217 + "objdump --start-address=%#0*" PRIx64 " --stop-address=%#0*" PRIx64 " -dS %s", 219 218 BITS_PER_LONG / 4, map__rip_2objdump(map, sym->start), 220 219 BITS_PER_LONG / 4, map__rip_2objdump(map, sym->end), path); 221 220 ··· 309 308 struct source_line *line; 310 309 char pattern[PATTERN_LEN + 1]; 311 310 312 - sprintf(pattern, "%0*Lx <", BITS_PER_LONG / 4, 311 + sprintf(pattern, "%0*" PRIx64 " <", BITS_PER_LONG / 4, 313 312 map__rip_2objdump(syme->map, symbol->start)); 314 313 315 314 pthread_mutex_lock(&syme->src->lock); ··· 538 537 if (nr_counters == 1 || !display_weighted) { 539 538 struct perf_evsel *first; 540 539 first = list_entry(evsel_list.next, struct perf_evsel, node); 541 - printf("%Ld", first->attr.sample_period); 540 + printf("%" PRIu64, (uint64_t)first->attr.sample_period); 542 541 if (freq) 543 542 printf("Hz "); 544 543 else ··· 641 640 642 641 percent_color_fprintf(stdout, "%4.1f%%", pcnt); 643 642 if (verbose) 644 - printf(" %016llx", sym->start); 643 + printf(" %016" PRIx64, sym->start); 645 644 printf(" %-*.*s", sym_width, sym_width, sym->name); 646 645 printf(" %-*.*s\n", dso_width, dso_width, 647 646 dso_width >= syme->map->dso->long_name_len ?
+3 -2
tools/perf/util/event.c
··· 459 459 int event__process_lost(event_t *self, struct sample_data *sample __used, 460 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 464 session->hists.stats.total_lost += self->lost.lost; 464 465 return 0; 465 466 } ··· 576 575 u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK; 577 576 int ret = 0; 578 577 579 - dump_printf(" %d/%d: [%#Lx(%#Lx) @ %#Lx]: %s\n", 578 + dump_printf(" %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %s\n", 580 579 self->mmap.pid, self->mmap.tid, self->mmap.start, 581 580 self->mmap.len, self->mmap.pgoff, self->mmap.filename); 582 581
+2 -2
tools/perf/util/header.c
··· 798 798 int feat, int fd) 799 799 { 800 800 if (lseek(fd, self->offset, SEEK_SET) == (off_t)-1) { 801 - pr_debug("Failed to lseek to %Ld offset for feature %d, " 802 - "continuing...\n", self->offset, feat); 801 + pr_debug("Failed to lseek to %" PRIu64 " offset for feature " 802 + "%d, continuing...\n", self->offset, feat); 803 803 return 0; 804 804 } 805 805
+9 -8
tools/perf/util/hist.c
··· 636 636 } 637 637 } 638 638 } else 639 - ret = snprintf(s, size, sep ? "%lld" : "%12lld ", period); 639 + ret = snprintf(s, size, sep ? "%" PRIu64 : "%12" PRIu64 " ", period); 640 640 641 641 if (symbol_conf.show_nr_samples) { 642 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 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 648 if (pair_hists) { ··· 971 971 sym_size = sym->end - sym->start; 972 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 976 if (offset >= sym_size) 977 977 return 0; ··· 980 980 h->sum++; 981 981 h->ip[offset]++; 982 982 983 - pr_debug3("%#Lx %s: period++ [ip: %#Lx, %#Lx] => %Ld\n", self->ms.sym->start, 984 - self->ms.sym->name, ip, ip - self->ms.sym->start, h->ip[offset]); 983 + pr_debug3("%#" PRIx64 " %s: period++ [ip: %#" PRIx64 ", %#" PRIx64 984 + "] => %" PRIu64 "\n", self->ms.sym->start, self->ms.sym->name, 985 + ip, ip - self->ms.sym->start, h->ip[offset]); 985 986 return 0; 986 987 } 987 988 ··· 1133 1132 goto out_free_filename; 1134 1133 } 1135 1134 1136 - pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__, 1135 + pr_debug("%s: filename=%s, sym=%s, start=%#" PRIx64 ", end=%#" PRIx64 "\n", __func__, 1137 1136 filename, sym->name, map->unmap_ip(map, sym->start), 1138 1137 map->unmap_ip(map, sym->end)); 1139 1138 ··· 1143 1142 dso, dso->long_name, sym, sym->name); 1144 1143 1145 1144 snprintf(command, sizeof(command), 1146 - "objdump --start-address=0x%016Lx --stop-address=0x%016Lx -dS -C %s|grep -v %s|expand", 1145 + "objdump --start-address=0x%016" PRIx64 " --stop-address=0x%016" PRIx64 " -dS -C %s|grep -v %s|expand", 1147 1146 map__rip_2objdump(map, sym->start), 1148 1147 map__rip_2objdump(map, sym->end), 1149 1148 symfs_filename, filename);
+2 -1
tools/perf/util/map.c
··· 1 1 #include "symbol.h" 2 2 #include <errno.h> 3 + #include <inttypes.h> 3 4 #include <limits.h> 4 5 #include <stdlib.h> 5 6 #include <string.h> ··· 196 195 197 196 size_t map__fprintf(struct map *self, FILE *fp) 198 197 { 199 - return fprintf(fp, " %Lx-%Lx %Lx %s\n", 198 + return fprintf(fp, " %" PRIx64 "-%" PRIx64 " %" PRIx64 " %s\n", 200 199 self->start, self->end, self->pgoff, self->dso->name); 201 200 } 202 201
+1 -1
tools/perf/util/parse-events.c
··· 279 279 static char buf[32]; 280 280 281 281 if (type == PERF_TYPE_RAW) { 282 - sprintf(buf, "raw 0x%llx", config); 282 + sprintf(buf, "raw 0x%" PRIx64, config); 283 283 return buf; 284 284 } 285 285
+1 -1
tools/perf/util/probe-event.c
··· 172 172 sym = __find_kernel_function_by_name(tp->symbol, &map); 173 173 if (sym) { 174 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 176 tp->offset, addr); 177 177 ret = find_perf_probe_point((unsigned long)addr, pp); 178 178 }
+15 -13
tools/perf/util/session.c
··· 652 652 { 653 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 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 662 static void perf_session__print_tstamp(struct perf_session *session, ··· 673 672 printf("%u ", sample->cpu); 674 673 675 674 if (session->sample_type & PERF_SAMPLE_TIME) 676 - printf("%Lu ", sample->time); 675 + printf("%" PRIu64 " ", sample->time); 677 676 } 678 677 679 678 static void dump_event(struct perf_session *session, event_t *event, ··· 682 681 if (!dump_trace) 683 682 return; 684 683 685 - printf("\n%#Lx [%#x]: event: %d\n", file_offset, event->header.size, 686 - event->header.type); 684 + printf("\n%#" PRIx64 " [%#x]: event: %d\n", 685 + file_offset, event->header.size, event->header.type); 687 686 688 687 trace_event(event); 689 688 690 689 if (sample) 691 690 perf_session__print_tstamp(session, event, sample); 692 691 693 - printf("%#Lx [%#x]: PERF_RECORD_%s", file_offset, event->header.size, 694 - event__get_event_name(event->header.type)); 692 + printf("%#" PRIx64 " [%#x]: PERF_RECORD_%s", file_offset, 693 + event->header.size, event__get_event_name(event->header.type)); 695 694 } 696 695 697 696 static void dump_sample(struct perf_session *session, event_t *event, ··· 700 699 if (!dump_trace) 701 700 return; 702 701 703 - printf("(IP, %d): %d/%d: %#Lx period: %Ld\n", event->header.misc, 704 - sample->pid, sample->tid, sample->ip, sample->period); 702 + printf("(IP, %d): %d/%d: %#" PRIx64 " period: %" PRIu64 "\n", 703 + event->header.misc, sample->pid, sample->tid, sample->ip, 704 + sample->period); 705 705 706 706 if (session->sample_type & PERF_SAMPLE_CALLCHAIN) 707 707 callchain__printf(sample); ··· 845 843 { 846 844 if (ops->lost == event__process_lost && 847 845 session->hists.stats.total_lost != 0) { 848 - ui__warning("Processed %Lu events and LOST %Lu!\n\n" 849 - "Check IO/CPU overload!\n\n", 846 + ui__warning("Processed %" PRIu64 " events and LOST %" PRIu64 847 + "!\n\nCheck IO/CPU overload!\n\n", 850 848 session->hists.stats.total_period, 851 849 session->hists.stats.total_lost); 852 850 } ··· 920 918 921 919 if (size == 0 || 922 920 (skip = perf_session__process_event(self, &event, ops, head)) < 0) { 923 - dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n", 921 + dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n", 924 922 head, event.header.size, event.header.type); 925 923 /* 926 924 * assume we lost track of the stream, check alignment, and ··· 1025 1023 1026 1024 if (size == 0 || 1027 1025 perf_session__process_event(session, event, ops, file_pos) < 0) { 1028 - dump_printf("%#Lx [%#x]: skipping unknown header type: %d\n", 1026 + dump_printf("%#" PRIx64 " [%#x]: skipping unknown header type: %d\n", 1029 1027 file_offset + head, event->header.size, 1030 1028 event->header.type); 1031 1029 /*
+3 -2
tools/perf/util/svghelper.c
··· 12 12 * of the License. 13 13 */ 14 14 15 + #include <inttypes.h> 15 16 #include <stdio.h> 16 17 #include <stdlib.h> 17 18 #include <unistd.h> ··· 95 94 96 95 total_height = (1 + rows + cpu2slot(cpus)) * SLOT_MULT; 97 96 fprintf(svgfile, "<?xml version=\"1.0\" standalone=\"no\"?> \n"); 98 - fprintf(svgfile, "<svg width=\"%i\" height=\"%llu\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height); 97 + fprintf(svgfile, "<svg width=\"%i\" height=\"%" PRIu64 "\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height); 99 98 100 99 fprintf(svgfile, "<defs>\n <style type=\"text/css\">\n <![CDATA[\n"); 101 100 ··· 484 483 color = 128; 485 484 } 486 485 487 - 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", 486 + 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", 488 487 time2pixels(i), SLOT_MULT/2, time2pixels(i), total_height, color, color, color, thickness); 489 488 490 489 i += 10000000;
+5 -4
tools/perf/util/symbol.c
··· 11 11 #include <sys/param.h> 12 12 #include <fcntl.h> 13 13 #include <unistd.h> 14 + #include <inttypes.h> 14 15 #include "build-id.h" 15 16 #include "debug.h" 16 17 #include "symbol.h" ··· 154 153 self->binding = binding; 155 154 self->namelen = namelen - 1; 156 155 157 - pr_debug4("%s: %s %#Lx-%#Lx\n", __func__, name, start, self->end); 156 + pr_debug4("%s: %s %#" PRIx64 "-%#" PRIx64 "\n", __func__, name, start, self->end); 158 157 159 158 memcpy(self->name, name, namelen); 160 159 ··· 168 167 169 168 static size_t symbol__fprintf(struct symbol *self, FILE *fp) 170 169 { 171 - return fprintf(fp, " %llx-%llx %c %s\n", 170 + return fprintf(fp, " %" PRIx64 "-%" PRIx64 " %c %s\n", 172 171 self->start, self->end, 173 172 self->binding == STB_GLOBAL ? 'g' : 174 173 self->binding == STB_LOCAL ? 'l' : 'w', ··· 1216 1215 } 1217 1216 1218 1217 if (curr_dso->adjust_symbols) { 1219 - pr_debug4("%s: adjusting symbol: st_value: %#Lx " 1220 - "sh_addr: %#Lx sh_offset: %#Lx\n", __func__, 1218 + pr_debug4("%s: adjusting symbol: st_value: %#" PRIx64 " " 1219 + "sh_addr: %#" PRIx64 " sh_offset: %#" PRIx64 "\n", __func__, 1221 1220 (u64)sym.st_value, (u64)shdr.sh_addr, 1222 1221 (u64)shdr.sh_offset); 1223 1222 sym.st_value -= shdr.sh_addr - shdr.sh_offset;
+6 -4
tools/perf/util/types.h
··· 1 1 #ifndef __PERF_TYPES_H 2 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 6 - * so that we can print it with %Lx without getting warnings. 7 + * We define u64 as uint64_t for every architecture 8 + * so that we can print it with "%"PRIx64 without getting warnings. 7 9 */ 8 - typedef unsigned long long u64; 9 - typedef signed long long s64; 10 + typedef uint64_t u64; 11 + typedef int64_t s64; 10 12 typedef unsigned int u32; 11 13 typedef signed int s32; 12 14 typedef unsigned short u16;
+1 -1
tools/perf/util/ui/browsers/hists.c
··· 350 350 if (self->ms.sym) 351 351 return self->ms.sym->name; 352 352 353 - snprintf(bf, bfsize, "%#Lx", self->ip); 353 + snprintf(bf, bfsize, "%#" PRIx64, self->ip); 354 354 return bf; 355 355 } 356 356
+3 -2
tools/perf/util/ui/browsers/map.c
··· 1 1 #include "../libslang.h" 2 2 #include <elf.h> 3 + #include <inttypes.h> 3 4 #include <sys/ttydefaults.h> 4 5 #include <ctype.h> 5 6 #include <string.h> ··· 58 57 int width; 59 58 60 59 ui_browser__set_percent_color(self, 0, current_entry); 61 - slsmg_printf("%*llx %*llx %c ", 60 + slsmg_printf("%*" PRIx64 " %*" PRIx64 " %c ", 62 61 mb->addrlen, sym->start, mb->addrlen, sym->end, 63 62 sym->binding == STB_GLOBAL ? 'g' : 64 63 sym->binding == STB_LOCAL ? 'l' : 'w'); ··· 151 150 ++mb.b.nr_entries; 152 151 } 153 152 154 - mb.addrlen = snprintf(tmp, sizeof(tmp), "%llx", maxaddr); 153 + mb.addrlen = snprintf(tmp, sizeof(tmp), "%" PRIx64, maxaddr); 155 154 return map_browser__run(&mb); 156 155 }
+5 -5
tools/perf/util/values.c
··· 150 150 if (width > tidwidth) 151 151 tidwidth = width; 152 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 154 if (width > counterwidth[j]) 155 155 counterwidth[j] = width; 156 156 } ··· 165 165 fprintf(fp, " %*d %*d", pidwidth, values->pid[i], 166 166 tidwidth, values->tid[i]); 167 167 for (j = 0; j < values->counters; j++) 168 - fprintf(fp, " %*Lu", 168 + fprintf(fp, " %*" PRIu64, 169 169 counterwidth[j], values->value[i][j]); 170 170 fprintf(fp, "\n"); 171 171 } ··· 196 196 width = strlen(values->countername[j]); 197 197 if (width > namewidth) 198 198 namewidth = width; 199 - width = snprintf(NULL, 0, "%llx", values->counterrawid[j]); 199 + width = snprintf(NULL, 0, "%" PRIx64, values->counterrawid[j]); 200 200 if (width > rawwidth) 201 201 rawwidth = width; 202 202 } 203 203 for (i = 0; i < values->threads; i++) { 204 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 206 if (width > countwidth) 207 207 countwidth = width; 208 208 } ··· 214 214 countwidth, "Count"); 215 215 for (i = 0; i < values->threads; i++) 216 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 218 pidwidth, values->pid[i], 219 219 tidwidth, values->tid[i], 220 220 namewidth, values->countername[j],