diff options
author | Jason Evans <je@facebook.com> | 2010-02-11 22:55:25 (GMT) |
---|---|---|
committer | Jason Evans <je@facebook.com> | 2010-02-11 22:55:25 (GMT) |
commit | cd90fca9282917f01002e63806095fe3e6d04f01 (patch) | |
tree | b12b42de5cc1c62a4e3b67ba020117beab13f855 /jemalloc | |
parent | 376b1529a383c39adf4674baf6db83a5e63f97ac (diff) | |
download | jemalloc-cd90fca9282917f01002e63806095fe3e6d04f01.zip jemalloc-cd90fca9282917f01002e63806095fe3e6d04f01.tar.gz jemalloc-cd90fca9282917f01002e63806095fe3e6d04f01.tar.bz2 |
Wrap mallctl* references with JEMALLOC_P().
Diffstat (limited to 'jemalloc')
-rw-r--r-- | jemalloc/include/jemalloc/internal/ctl.h | 9 | ||||
-rw-r--r-- | jemalloc/src/stats.c | 47 |
2 files changed, 33 insertions, 23 deletions
diff --git a/jemalloc/include/jemalloc/internal/ctl.h b/jemalloc/include/jemalloc/internal/ctl.h index 64a620a..959916c 100644 --- a/jemalloc/include/jemalloc/internal/ctl.h +++ b/jemalloc/include/jemalloc/internal/ctl.h @@ -73,7 +73,8 @@ int ctl_bymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp, bool ctl_boot(void); #define xmallctl(name, oldp, oldlenp, newp, newlen) do { \ - if (mallctl(name, oldp, oldlenp, newp, newlen) != 0) { \ + if (JEMALLOC_P(mallctl)(name, oldp, oldlenp, newp, newlen) \ + != 0) { \ malloc_write4("<jemalloc>: Invalid xmallctl(\"", name, \ "\", ...) call\n", ""); \ abort(); \ @@ -81,7 +82,7 @@ bool ctl_boot(void); } while (0) #define xmallctlnametomib(name, mibp, miblenp) do { \ - if (mallctlnametomib(name, mibp, miblenp) != 0) { \ + if (JEMALLOC_P(mallctlnametomib)(name, mibp, miblenp) != 0) { \ malloc_write4( \ "<jemalloc>: Invalid xmallctlnametomib(\"", name, \ "\", ...) call\n", ""); \ @@ -90,8 +91,8 @@ bool ctl_boot(void); } while (0) #define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \ - if (mallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) \ - != 0) { \ + if (JEMALLOC_P(mallctlbymib)(mib, miblen, oldp, oldlenp, newp, \ + newlen) != 0) { \ malloc_write4( \ "<jemalloc>: Invalid xmallctlbymib() call\n", "", \ "", ""); \ diff --git a/jemalloc/src/stats.c b/jemalloc/src/stats.c index 9798458..7c6d8c9 100644 --- a/jemalloc/src/stats.c +++ b/jemalloc/src/stats.c @@ -429,24 +429,33 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *, "\n", ""); write4(w4opaque, "Boolean JEMALLOC_OPTIONS: ", "", "", ""); - if ((err = mallctl("opt.abort", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.abort", &bv, &bsz, NULL, 0)) + == 0) write4(w4opaque, bv ? "A" : "a", "", "", ""); - if ((err = mallctl("opt.prof", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.prof", &bv, &bsz, NULL, 0)) + == 0) write4(w4opaque, bv ? "F" : "f", "", "", ""); - if ((err = mallctl("opt.junk", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.junk", &bv, &bsz, NULL, 0)) + == 0) write4(w4opaque, bv ? "J" : "j", "", "", ""); - if ((err = mallctl("opt.prof_leak", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.prof_leak", &bv, &bsz, NULL, + 0)) == 0) write4(w4opaque, bv ? "L" : "l", "", "", ""); - if ((err = mallctl("opt.overcommit", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.overcommit", &bv, &bsz, + NULL, 0)) == 0) write4(w4opaque, bv ? "O" : "o", "", "", ""); write4(w4opaque, "P", "", "", ""); - if ((err = mallctl("opt.prof_udump", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.prof_udump", &bv, &bsz, + NULL, 0)) == 0) write4(w4opaque, bv ? "U" : "u", "", "", ""); - if ((err = mallctl("opt.sysv", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.sysv", &bv, &bsz, NULL, 0)) + == 0) write4(w4opaque, bv ? "V" : "v", "", "", ""); - if ((err = mallctl("opt.xmalloc", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.xmalloc", &bv, &bsz, NULL, + 0)) == 0) write4(w4opaque, bv ? "X" : "x", "", "", ""); - if ((err = mallctl("opt.zero", &bv, &bsz, NULL, 0)) == 0) + if ((err = JEMALLOC_P(mallctl)("opt.zero", &bv, &bsz, NULL, 0)) + == 0) write4(w4opaque, bv ? "Z" : "z", "", "", ""); write4(w4opaque, "\n", "", "", ""); @@ -473,8 +482,8 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *, write4(w4opaque, "Medium spacing: ", umax2s(sv, 10, s), "\n", ""); - if ((err = mallctl("arenas.tspace_min", &sv, &ssz, NULL, 0)) == - 0) { + if ((err = JEMALLOC_P(mallctl)("arenas.tspace_min", &sv, &ssz, + NULL, 0)) == 0) { write4(w4opaque, "Tiny 2^n-spaced sizes: [", umax2s(sv, 10, s), "..", ""); @@ -516,8 +525,8 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *, "Min active:dirty page ratio per arena: N/A\n", "", "", ""); } - if ((err = mallctl("opt.lg_tcache_nslots", &sv, &ssz, NULL, 0)) - == 0) { + if ((err = JEMALLOC_P(mallctl)("opt.lg_tcache_nslots", &sv, + &ssz, NULL, 0)) == 0) { size_t tcache_nslots, tcache_gc_sweep; tcache_nslots = (1U << sv); @@ -531,13 +540,13 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *, tcache_nslots && ssv >= 0 ? umax2s(tcache_gc_sweep, 10, s) : "N/A", "\n", ""); } - if ((err = mallctl("opt.lg_prof_bt_max", &sv, &ssz, NULL, 0)) - == 0) { + if ((err = JEMALLOC_P(mallctl)("opt.lg_prof_bt_max", &sv, &ssz, + NULL, 0)) == 0) { write4(w4opaque, "Maximum profile backtrace depth: ", umax2s((1U << sv), 10, s), "\n", ""); } - if ((err = mallctl("opt.lg_prof_interval", &sv, &ssz, NULL, 0)) - == 0) { + if ((err = JEMALLOC_P(mallctl)("opt.lg_prof_interval", &sv, + &ssz, NULL, 0)) == 0) { write4(w4opaque, "Average profile dump interval: ", umax2s((1U << sv), 10, s), "", ""); write4(w4opaque, " (2^", umax2s(sv, 10, s), ")\n", ""); @@ -571,8 +580,8 @@ stats_print(void (*write4)(void *, const char *, const char *, const char *, CTL_GET("stats.chunks.total", &chunks_total, uint64_t); CTL_GET("stats.chunks.high", &chunks_high, size_t); CTL_GET("stats.chunks.current", &chunks_current, size_t); - if ((err = mallctl("swap.avail", &swap_avail, &ssz, NULL, 0)) - == 0) { + if ((err = JEMALLOC_P(mallctl)("swap.avail", &swap_avail, &ssz, + NULL, 0)) == 0) { size_t lg_chunk; malloc_cprintf(write4, w4opaque, "chunks: nchunks " |