summaryrefslogtreecommitdiffstats
path: root/src/prof.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2015-07-23 20:56:25 (GMT)
committerJason Evans <jasone@canonware.com>2015-07-23 20:56:25 (GMT)
commit5fae7dc1b316d0e93aa20cc3aaf050f509aec705 (patch)
treee17384be2f44b4cdffa4748f50f4f30dc7dd9c12 /src/prof.c
parente475ff16004d9a7c76a01a71e6a52323e6bf1485 (diff)
downloadjemalloc-5fae7dc1b316d0e93aa20cc3aaf050f509aec705.zip
jemalloc-5fae7dc1b316d0e93aa20cc3aaf050f509aec705.tar.gz
jemalloc-5fae7dc1b316d0e93aa20cc3aaf050f509aec705.tar.bz2
Fix MinGW-related portability issues.
Create and use FMT* macros that are equivalent to the PRI* macros that inttypes.h defines. This allows uniform use of the Unix-specific format specifiers, e.g. "%zu", as well as avoiding Windows-specific definitions of e.g. PRIu64. Add ffs()/ffsl() support for compiling with gcc. Extract compatibility definitions of ENOENT, EINVAL, EAGAIN, EPERM, ENOMEM, and ENORANGE into include/msvc_compat/windows_extra.h and use the file for tests as well as for core jemalloc code.
Diffstat (limited to 'src/prof.c')
-rw-r--r--src/prof.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/prof.c b/src/prof.c
index babdbd6..a05792f 100644
--- a/src/prof.c
+++ b/src/prof.c
@@ -1095,7 +1095,7 @@ prof_tctx_dump_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg)
bool propagate_err = *(bool *)arg;
if (prof_dump_printf(propagate_err,
- " t%"PRIu64": %"PRIu64": %"PRIu64" [%"PRIu64": %"PRIu64"]\n",
+ " t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n",
tctx->thr_uid, tctx->dump_cnts.curobjs, tctx->dump_cnts.curbytes,
tctx->dump_cnts.accumobjs, tctx->dump_cnts.accumbytes))
return (tctx);
@@ -1247,7 +1247,7 @@ prof_tdata_dump_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata, void *arg)
return (NULL);
if (prof_dump_printf(propagate_err,
- " t%"PRIu64": %"PRIu64": %"PRIu64" [%"PRIu64": %"PRIu64"]%s%s\n",
+ " t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]%s%s\n",
tdata->thr_uid, tdata->cnt_summed.curobjs,
tdata->cnt_summed.curbytes, tdata->cnt_summed.accumobjs,
tdata->cnt_summed.accumbytes,
@@ -1267,8 +1267,8 @@ prof_dump_header(bool propagate_err, const prof_cnt_t *cnt_all)
bool ret;
if (prof_dump_printf(propagate_err,
- "heap_v2/%"PRIu64"\n"
- " t*: %"PRIu64": %"PRIu64" [%"PRIu64": %"PRIu64"]\n",
+ "heap_v2/%"FMTu64"\n"
+ " t*: %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n",
((uint64_t)1U << lg_prof_sample), cnt_all->curobjs,
cnt_all->curbytes, cnt_all->accumobjs, cnt_all->accumbytes))
return (true);
@@ -1311,7 +1311,7 @@ prof_dump_gctx(bool propagate_err, prof_gctx_t *gctx, const prof_bt_t *bt,
goto label_return;
}
for (i = 0; i < bt->len; i++) {
- if (prof_dump_printf(propagate_err, " %#"PRIxPTR,
+ if (prof_dump_printf(propagate_err, " %#"FMTxPTR,
(uintptr_t)bt->vec[i])) {
ret = true;
goto label_return;
@@ -1320,7 +1320,7 @@ prof_dump_gctx(bool propagate_err, prof_gctx_t *gctx, const prof_bt_t *bt,
if (prof_dump_printf(propagate_err,
"\n"
- " t*: %"PRIu64": %"PRIu64" [%"PRIu64": %"PRIu64"]\n",
+ " t*: %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n",
gctx->cnt_summed.curobjs, gctx->cnt_summed.curbytes,
gctx->cnt_summed.accumobjs, gctx->cnt_summed.accumbytes)) {
ret = true;
@@ -1412,8 +1412,8 @@ prof_leakcheck(const prof_cnt_t *cnt_all, size_t leak_ngctx,
{
if (cnt_all->curbytes != 0) {
- malloc_printf("<jemalloc>: Leak summary: %"PRIu64" byte%s, %"
- PRIu64" object%s, %"PRIzu" context%s\n",
+ malloc_printf("<jemalloc>: Leak summary: %"FMTu64" byte%s, %"
+ FMTu64" object%s, %zu context%s\n",
cnt_all->curbytes, (cnt_all->curbytes != 1) ? "s" : "",
cnt_all->curobjs, (cnt_all->curobjs != 1) ? "s" : "",
leak_ngctx, (leak_ngctx != 1) ? "s" : "");
@@ -1533,12 +1533,12 @@ prof_dump_filename(char *filename, char v, uint64_t vseq)
if (vseq != VSEQ_INVALID) {
/* "<prefix>.<pid>.<seq>.v<vseq>.heap" */
malloc_snprintf(filename, DUMP_FILENAME_BUFSIZE,
- "%s.%d.%"PRIu64".%c%"PRIu64".heap",
+ "%s.%d.%"FMTu64".%c%"FMTu64".heap",
opt_prof_prefix, (int)getpid(), prof_dump_seq, v, vseq);
} else {
/* "<prefix>.<pid>.<seq>.<v>.heap" */
malloc_snprintf(filename, DUMP_FILENAME_BUFSIZE,
- "%s.%d.%"PRIu64".%c.heap",
+ "%s.%d.%"FMTu64".%c.heap",
opt_prof_prefix, (int)getpid(), prof_dump_seq, v);
}
prof_dump_seq++;