summaryrefslogtreecommitdiff
path: root/lib/libperfuse/debug.c
diff options
context:
space:
mode:
authorriz <riz@NetBSD.org>2011-12-29 01:40:32 +0000
committerriz <riz@NetBSD.org>2011-12-29 01:40:32 +0000
commit74ca4079b8dbe696a91a8428d4a0e2acabd05cee (patch)
treeafefd1c92485ba84e0f055556358f31e49c2ba2e /lib/libperfuse/debug.c
parente86bcb522b4f012af3241a956f6cecb4ec039784 (diff)
Cast time_t to intmax_t for printf purposes, and format with %j. Fixes
build on amd64 and probably i386 as well.
Diffstat (limited to 'lib/libperfuse/debug.c')
-rw-r--r--lib/libperfuse/debug.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/libperfuse/debug.c b/lib/libperfuse/debug.c
index dba1660c5d7..b72ea78de24 100644
--- a/lib/libperfuse/debug.c
+++ b/lib/libperfuse/debug.c
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.6 2011/12/28 17:33:52 manu Exp $ */
+/* $NetBSD: debug.c,v 1.7 2011/12/29 01:40:32 riz Exp $ */
/*-
* Copyright (c) 2010 Emmanuel Dreyfus. All rights reserved.
@@ -159,8 +159,9 @@ perfuse_trace_dump(pu, fp)
TAILQ_FOREACH(pt, &ps->ps_trace, pt_list) {
const char *quote = pt->pt_path[0] != '\0' ? "\"" : "";
- fprintf(fp, "%lu.%09ld %s %s%s%s %s ",
- pt->pt_start.tv_sec, pt->pt_start.tv_nsec,
+ fprintf(fp, "%ju.%09jd %s %s%s%s %s ",
+ (intmax_t)pt->pt_start.tv_sec,
+ (intmax_t)pt->pt_start.tv_nsec,
perfuse_opname(pt->pt_opcode),
quote, pt->pt_path, quote,
pt->pt_extra);
@@ -172,8 +173,8 @@ perfuse_trace_dump(pu, fp)
ts.tv_nsec = 0; /* delint */
timespecsub(&pt->pt_end, &pt->pt_start, &ts);
- fprintf(fp, "error = %d elapsed = %lu.%09lu ",
- pt->pt_error, ts.tv_sec, ts.tv_nsec);
+ fprintf(fp, "error = %d elapsed = %ju.%09lu ",
+ pt->pt_error, (intmax_t)ts.tv_sec, ts.tv_nsec);
count[pt->pt_opcode]++;
timespecadd(&ts_total[pt->pt_opcode],
@@ -206,11 +207,12 @@ perfuse_trace_dump(pu, fp)
min = 0;
}
- fprintf(fp, "%s\t%d\t%ld.%09ld\t%ld.%09ld\t%ld.%09ld\t\n",
+ fprintf(fp, "%s\t%d\t%jd.%09ld\t%jd.%09ld\t%jd.%09ld\t\n",
perfuse_opname(i), count[i],
- min, ts_min[i].tv_nsec,
- (time_t)(avg / 1000000000L), (long)(avg % 1000000000L),
- ts_max[i].tv_sec, ts_max[i].tv_nsec);
+ (intmax_t)min, ts_min[i].tv_nsec,
+ (intmax_t)(avg / 1000000000L),
+ (long)(avg % 1000000000L),
+ (intmax_t)ts_max[i].tv_sec, ts_max[i].tv_nsec);
}
(void)fflush(fp);