2
0

prof_accum.h 794 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "test/jemalloc_test.h"
  2. #define NTHREADS 4
  3. #define NALLOCS_PER_THREAD 50
  4. #define DUMP_INTERVAL 1
  5. #define BT_COUNT_CHECK_INTERVAL 5
  6. #define alloc_n_proto(n) \
  7. void *alloc_##n(unsigned bits);
  8. alloc_n_proto(0)
  9. alloc_n_proto(1)
  10. #define alloc_n_gen(n) \
  11. void * \
  12. alloc_##n(unsigned bits) \
  13. { \
  14. void *p; \
  15. \
  16. if (bits == 0) \
  17. p = mallocx(1, 0); \
  18. else { \
  19. switch (bits & 0x1U) { \
  20. case 0: \
  21. p = (alloc_0(bits >> 1)); \
  22. break; \
  23. case 1: \
  24. p = (alloc_1(bits >> 1)); \
  25. break; \
  26. default: not_reached(); \
  27. } \
  28. } \
  29. /* Intentionally sabotage tail call optimization. */ \
  30. assert_ptr_not_null(p, "Unexpected mallocx() failure"); \
  31. return (p); \
  32. }