From b1b9ad6598f9857d97ea4950be2ea4d5ef5a4a60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Tue, 27 Jun 2017 01:36:10 +0200 Subject: [PATCH] Update jemalloc metrics --- lib/ProxySQL_Admin.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/ProxySQL_Admin.cpp b/lib/ProxySQL_Admin.cpp index d3a0ac44c..e17977b91 100644 --- a/lib/ProxySQL_Admin.cpp +++ b/lib/ProxySQL_Admin.cpp @@ -3384,18 +3384,20 @@ void ProxySQL_Admin::stats___memory_metrics() { free(query); #ifndef NOJEM { + uint64_t epoch = 1; size_t allocated = 0, resident = 0, active = 0, mapped = 0 , metadata = 0, retained = 0 , sz = sizeof(size_t); + mallctl("epoch", &epoch, &sz, &epoch, sz); mallctl("stats.resident", &resident, &sz, NULL, 0); mallctl("stats.active", &active, &sz, NULL, 0); mallctl("stats.allocated", &allocated, &sz, NULL, 0); mallctl("stats.mapped", &mapped, &sz, NULL, 0); mallctl("stats.metadata", &metadata, &sz, NULL, 0); mallctl("stats.retained", &retained, &sz, NULL, 0); - float frag_pct = ((float)active / allocated)*100 - 100; - size_t frag_bytes = active - allocated; - float rss_pct = ((float)resident / allocated)*100 - 100; - size_t rss_bytes = resident - allocated; - float metadata_pct = ((float)metadata / resident)*100; +// float frag_pct = ((float)active / allocated)*100 - 100; +// size_t frag_bytes = active - allocated; +// float rss_pct = ((float)resident / allocated)*100 - 100; +// size_t rss_bytes = resident - allocated; +// float metadata_pct = ((float)metadata / resident)*100; vn=(char *)"jemalloc_resident"; sprintf(bu,"%lu",resident); query=(char *)malloc(strlen(a)+strlen(vn)+strlen(bu)+16);