Expose prof_data testing internals only in prof tests

This commit is contained in:
Yinan Zhang 2020-03-31 10:13:55 -07:00
parent f43ac8543e
commit 8118056c03
6 changed files with 16 additions and 6 deletions

View File

@ -19,4 +19,12 @@ void bt_init(prof_bt_t *bt, void **vec);
void prof_backtrace(tsd_t *tsd, prof_bt_t *bt); void prof_backtrace(tsd_t *tsd, prof_bt_t *bt);
void prof_tctx_try_destroy(tsd_t *tsd, prof_tctx_t *tctx); void prof_tctx_try_destroy(tsd_t *tsd, prof_tctx_t *tctx);
/* Used in unit tests. */
size_t prof_tdata_count(void);
size_t prof_bt_count(void);
typedef void (prof_dump_header_t)(tsdn_t *, const prof_cnt_t *);
extern prof_dump_header_t *JET_MUTABLE prof_dump_header;
void prof_cnt_all(uint64_t *curobjs, uint64_t *curbytes, uint64_t *accumobjs,
uint64_t *accumbytes);
#endif /* JEMALLOC_INTERNAL_PROF_DATA_H */ #endif /* JEMALLOC_INTERNAL_PROF_DATA_H */

View File

@ -92,18 +92,12 @@ void prof_sample_event_handler(tsd_t *tsd, uint64_t elapsed);
/* Used by unit tests. */ /* Used by unit tests. */
typedef int (prof_sys_thread_name_read_t)(char *buf, size_t limit); typedef int (prof_sys_thread_name_read_t)(char *buf, size_t limit);
extern prof_sys_thread_name_read_t *JET_MUTABLE prof_sys_thread_name_read; extern prof_sys_thread_name_read_t *JET_MUTABLE prof_sys_thread_name_read;
size_t prof_tdata_count(void);
size_t prof_bt_count(void);
typedef int (prof_dump_open_file_t)(const char *, int); typedef int (prof_dump_open_file_t)(const char *, int);
extern prof_dump_open_file_t *JET_MUTABLE prof_dump_open_file; extern prof_dump_open_file_t *JET_MUTABLE prof_dump_open_file;
typedef ssize_t (prof_dump_write_file_t)(int, const void *, size_t); typedef ssize_t (prof_dump_write_file_t)(int, const void *, size_t);
extern prof_dump_write_file_t *JET_MUTABLE prof_dump_write_file; extern prof_dump_write_file_t *JET_MUTABLE prof_dump_write_file;
typedef void (prof_dump_header_t)(tsdn_t *, const prof_cnt_t *);
extern prof_dump_header_t *JET_MUTABLE prof_dump_header;
typedef int (prof_dump_open_maps_t)(); typedef int (prof_dump_open_maps_t)();
extern prof_dump_open_maps_t *JET_MUTABLE prof_dump_open_maps; extern prof_dump_open_maps_t *JET_MUTABLE prof_dump_open_maps;
void prof_cnt_all(uint64_t *curobjs, uint64_t *curbytes, uint64_t *accumobjs,
uint64_t *accumbytes);
bool prof_log_start(tsdn_t *tsdn, const char *filename); bool prof_log_start(tsdn_t *tsdn, const char *filename);
bool prof_log_stop(tsdn_t *tsdn); bool prof_log_stop(tsdn_t *tsdn);

View File

@ -1,5 +1,7 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
#include "jemalloc/internal/prof_data.h"
#define NTHREADS 4 #define NTHREADS 4
#define NALLOCS_PER_THREAD 50 #define NALLOCS_PER_THREAD 50
#define DUMP_INTERVAL 1 #define DUMP_INTERVAL 1

View File

@ -1,5 +1,7 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
#include "jemalloc/internal/prof_data.h"
static void static void
mallctl_bool_get(const char *name, bool expected, const char *func, int line) { mallctl_bool_get(const char *name, bool expected, const char *func, int line) {
bool old; bool old;

View File

@ -1,5 +1,7 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
#include "jemalloc/internal/prof_data.h"
static int static int
prof_dump_open_file_intercept(const char *filename, int mode) { prof_dump_open_file_intercept(const char *filename, int mode) {
int fd; int fd;

View File

@ -1,5 +1,7 @@
#include "test/jemalloc_test.h" #include "test/jemalloc_test.h"
#include "jemalloc/internal/prof_data.h"
TEST_BEGIN(test_prof_realloc) { TEST_BEGIN(test_prof_realloc) {
tsd_t *tsd; tsd_t *tsd;
int flags; int flags;