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>
This commit is contained in:
@ -150,7 +150,7 @@ static void perf_read_values__display_pretty(FILE *fp,
|
||||
if (width > tidwidth)
|
||||
tidwidth = width;
|
||||
for (j = 0; j < values->counters; j++) {
|
||||
width = snprintf(NULL, 0, "%Lu", values->value[i][j]);
|
||||
width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]);
|
||||
if (width > counterwidth[j])
|
||||
counterwidth[j] = width;
|
||||
}
|
||||
@ -165,7 +165,7 @@ static void perf_read_values__display_pretty(FILE *fp,
|
||||
fprintf(fp, " %*d %*d", pidwidth, values->pid[i],
|
||||
tidwidth, values->tid[i]);
|
||||
for (j = 0; j < values->counters; j++)
|
||||
fprintf(fp, " %*Lu",
|
||||
fprintf(fp, " %*" PRIu64,
|
||||
counterwidth[j], values->value[i][j]);
|
||||
fprintf(fp, "\n");
|
||||
}
|
||||
@ -196,13 +196,13 @@ static void perf_read_values__display_raw(FILE *fp,
|
||||
width = strlen(values->countername[j]);
|
||||
if (width > namewidth)
|
||||
namewidth = width;
|
||||
width = snprintf(NULL, 0, "%llx", values->counterrawid[j]);
|
||||
width = snprintf(NULL, 0, "%" PRIx64, values->counterrawid[j]);
|
||||
if (width > rawwidth)
|
||||
rawwidth = width;
|
||||
}
|
||||
for (i = 0; i < values->threads; i++) {
|
||||
for (j = 0; j < values->counters; j++) {
|
||||
width = snprintf(NULL, 0, "%Lu", values->value[i][j]);
|
||||
width = snprintf(NULL, 0, "%" PRIu64, values->value[i][j]);
|
||||
if (width > countwidth)
|
||||
countwidth = width;
|
||||
}
|
||||
@ -214,7 +214,7 @@ static void perf_read_values__display_raw(FILE *fp,
|
||||
countwidth, "Count");
|
||||
for (i = 0; i < values->threads; i++)
|
||||
for (j = 0; j < values->counters; j++)
|
||||
fprintf(fp, " %*d %*d %*s %*llx %*Lu\n",
|
||||
fprintf(fp, " %*d %*d %*s %*" PRIx64 " %*" PRIu64,
|
||||
pidwidth, values->pid[i],
|
||||
tidwidth, values->tid[i],
|
||||
namewidth, values->countername[j],
|
||||
|
Reference in New Issue
Block a user