From 806736cdf91658e7a8e1a2d8631b82763b508c36 Mon Sep 17 00:00:00 2001 From: Oran Agra Date: Sun, 18 Feb 2018 17:36:21 +0200 Subject: Adding real allocator fragmentation to INFO and MEMORY command + active defrag test other fixes / improvements: - LUA script memory isn't taken from zmalloc (taken from libc malloc) so it can cause high fragmentation ratio to be displayed (which is false) - there was a problem with "fragmentation" info being calculated from RSS and used_memory sampled at different times (now sampling them together) other details: - adding a few more allocator info fields to INFO and MEMORY commands - improve defrag test to measure defrag latency of big keys - increasing the accuracy of the defrag test (by looking at real grag info) this way we can use an even lower threshold and still avoid false positives - keep the old (total) "fragmentation" field unchanged, but add new ones for spcific things - add these the MEMORY DOCTOR command - deduct LUA memory from the rss in case of non jemalloc allocator (one for which we don't "allocator active/used") - reduce sampling rate of the rss and allocator info --- src/zmalloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/zmalloc.h') diff --git a/src/zmalloc.h b/src/zmalloc.h index 64f2f36aa..3c926bcbe 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -79,8 +79,8 @@ void zfree(void *ptr); char *zstrdup(const char *s); size_t zmalloc_used_memory(void); void zmalloc_set_oom_handler(void (*oom_handler)(size_t)); -float zmalloc_get_fragmentation_ratio(size_t rss); size_t zmalloc_get_rss(void); +int zmalloc_get_allocator_info(size_t *allocated, size_t *active, size_t *resident); size_t zmalloc_get_private_dirty(long pid); size_t zmalloc_get_smap_bytes_by_field(char *field, long pid); size_t zmalloc_get_memory_size(void); -- cgit v1.2.1