summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorQi Wang <interwq@gwu.edu>2017-05-12 19:30:33 (GMT)
committerQi Wang <interwq@gmail.com>2017-05-23 19:26:20 (GMT)
commit2bee0c6251856f48ed6882df2f02a060c0a14829 (patch)
treeabca780861059dadb43e1c74b908e78d6d56d052 /include
parentb693c7868ea965407aca4cb01fdb8fe9af14adce (diff)
downloadjemalloc-2bee0c6251856f48ed6882df2f02a060c0a14829.zip
jemalloc-2bee0c6251856f48ed6882df2f02a060c0a14829.tar.gz
jemalloc-2bee0c6251856f48ed6882df2f02a060c0a14829.tar.bz2
Add background thread related stats.
Diffstat (limited to 'include')
-rw-r--r--include/jemalloc/internal/background_thread_externs.h2
-rw-r--r--include/jemalloc/internal/background_thread_structs.h11
-rw-r--r--include/jemalloc/internal/ctl.h1
-rw-r--r--include/jemalloc/internal/nstime.h2
4 files changed, 16 insertions, 0 deletions
diff --git a/include/jemalloc/internal/background_thread_externs.h b/include/jemalloc/internal/background_thread_externs.h
index 993f0e3..fe25acf 100644
--- a/include/jemalloc/internal/background_thread_externs.h
+++ b/include/jemalloc/internal/background_thread_externs.h
@@ -19,6 +19,8 @@ void background_thread_prefork0(tsdn_t *tsdn);
void background_thread_prefork1(tsdn_t *tsdn);
void background_thread_postfork_parent(tsdn_t *tsdn);
void background_thread_postfork_child(tsdn_t *tsdn);
+bool background_thread_stats_read(tsdn_t *tsdn,
+ background_thread_stats_t *stats);
#if defined(JEMALLOC_BACKGROUND_THREAD) || defined(JEMALLOC_LAZY_LOCK)
extern int (*pthread_create_fptr)(pthread_t *__restrict, const pthread_attr_t *,
diff --git a/include/jemalloc/internal/background_thread_structs.h b/include/jemalloc/internal/background_thread_structs.h
index a43d600..c4eb827 100644
--- a/include/jemalloc/internal/background_thread_structs.h
+++ b/include/jemalloc/internal/background_thread_structs.h
@@ -18,8 +18,19 @@ struct background_thread_info_s {
* background thread to wake up earlier.
*/
size_t npages_to_purge_new;
+ /* Stats: total number of runs since started. */
+ uint64_t tot_n_runs;
+ /* Stats: total sleep time since started. */
+ nstime_t tot_sleep_time;
#endif /* ifdef JEMALLOC_BACKGROUND_THREAD */
};
typedef struct background_thread_info_s background_thread_info_t;
+struct background_thread_stats_s {
+ size_t num_threads;
+ uint64_t num_runs;
+ nstime_t run_interval;
+};
+typedef struct background_thread_stats_s background_thread_stats_t;
+
#endif /* JEMALLOC_INTERNAL_BACKGROUND_THREAD_STRUCTS_H */
diff --git a/include/jemalloc/internal/ctl.h b/include/jemalloc/internal/ctl.h
index 60b3979..f159383 100644
--- a/include/jemalloc/internal/ctl.h
+++ b/include/jemalloc/internal/ctl.h
@@ -52,6 +52,7 @@ typedef struct ctl_stats_s {
size_t mapped;
size_t retained;
+ background_thread_stats_t background_thread;
mutex_prof_data_t mutex_prof_data[mutex_prof_num_global_mutexes];
} ctl_stats_t;
diff --git a/include/jemalloc/internal/nstime.h b/include/jemalloc/internal/nstime.h
index ad7efb8..17c177c 100644
--- a/include/jemalloc/internal/nstime.h
+++ b/include/jemalloc/internal/nstime.h
@@ -18,7 +18,9 @@ uint64_t nstime_nsec(const nstime_t *time);
void nstime_copy(nstime_t *time, const nstime_t *source);
int nstime_compare(const nstime_t *a, const nstime_t *b);
void nstime_add(nstime_t *time, const nstime_t *addend);
+void nstime_iadd(nstime_t *time, uint64_t addend);
void nstime_subtract(nstime_t *time, const nstime_t *subtrahend);
+void nstime_isubtract(nstime_t *time, uint64_t subtrahend);
void nstime_imultiply(nstime_t *time, uint64_t multiplier);
void nstime_idivide(nstime_t *time, uint64_t divisor);
uint64_t nstime_divide(const nstime_t *time, const nstime_t *divisor);