summaryrefslogtreecommitdiffstats
path: root/test/unit/prof_accum.c
diff options
context:
space:
mode:
authorJason Evans <jasone@canonware.com>2017-06-13 19:49:58 (GMT)
committerJason Evans <jasone@canonware.com>2017-06-13 19:51:09 (GMT)
commit5018fe3f0979b7f9db9930accdf7ee31071fd703 (patch)
tree894055b5ff4ccde3d9d782861d45af4664f12ad2 /test/unit/prof_accum.c
parent04380e79f1e2428bd0ad000bbc6e3d2dfc6b66a5 (diff)
parentba29113e5a58caeb6b4a65b1db6d8efae79cae45 (diff)
downloadjemalloc-5.0.0.zip
jemalloc-5.0.0.tar.gz
jemalloc-5.0.0.tar.bz2
Merge branch 'dev'5.0.0
Diffstat (limited to 'test/unit/prof_accum.c')
-rw-r--r--test/unit/prof_accum.c38
1 files changed, 16 insertions, 22 deletions
diff --git a/test/unit/prof_accum.c b/test/unit/prof_accum.c
index 031f083..2522006 100644
--- a/test/unit/prof_accum.c
+++ b/test/unit/prof_accum.c
@@ -1,31 +1,27 @@
#include "test/jemalloc_test.h"
-#define NTHREADS 4
-#define NALLOCS_PER_THREAD 50
-#define DUMP_INTERVAL 1
-#define BT_COUNT_CHECK_INTERVAL 5
+#define NTHREADS 4
+#define NALLOCS_PER_THREAD 50
+#define DUMP_INTERVAL 1
+#define BT_COUNT_CHECK_INTERVAL 5
static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
+prof_dump_open_intercept(bool propagate_err, const char *filename) {
int fd;
fd = open("/dev/null", O_WRONLY);
assert_d_ne(fd, -1, "Unexpected open() failure");
- return (fd);
+ return fd;
}
static void *
-alloc_from_permuted_backtrace(unsigned thd_ind, unsigned iteration)
-{
-
- return (btalloc(1, thd_ind*NALLOCS_PER_THREAD + iteration));
+alloc_from_permuted_backtrace(unsigned thd_ind, unsigned iteration) {
+ return btalloc(1, thd_ind*NALLOCS_PER_THREAD + iteration);
}
static void *
-thd_start(void *varg)
-{
+thd_start(void *varg) {
unsigned thd_ind = *(unsigned *)varg;
size_t bt_count_prev, bt_count;
unsigned i_prev, i;
@@ -50,11 +46,10 @@ thd_start(void *varg)
}
}
- return (NULL);
+ return NULL;
}
-TEST_BEGIN(test_idump)
-{
+TEST_BEGIN(test_idump) {
bool active;
thd_t thds[NTHREADS];
unsigned thd_args[NTHREADS];
@@ -73,15 +68,14 @@ TEST_BEGIN(test_idump)
thd_args[i] = i;
thd_create(&thds[i], thd_start, (void *)&thd_args[i]);
}
- for (i = 0; i < NTHREADS; i++)
+ for (i = 0; i < NTHREADS; i++) {
thd_join(thds[i], NULL);
+ }
}
TEST_END
int
-main(void)
-{
-
- return (test(
- test_idump));
+main(void) {
+ return test_no_reentrancy(
+ test_idump);
}