X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=libmemcached%2Fanalyze.c;h=7dcbf8cb3bcc255b601a3bfbfbdb021b1c1809d8;hb=6cd2ec807b660cbdc893bfbf67d6ad306fb4b942;hp=5c1c7e4762c02c2abb1289f55a211991ca51a87d;hpb=7c7750f02368b570353ea109f23a0ea26d226e02;p=awesomized%2Flibmemcached diff --git a/libmemcached/analyze.c b/libmemcached/analyze.c index 5c1c7e47..7dcbf8cb 100644 --- a/libmemcached/analyze.c +++ b/libmemcached/analyze.c @@ -67,10 +67,10 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, uint64_t total_get_cmds= 0, total_get_hits= 0; uint32_t server_count, x; memcached_analysis_st *result; - + *error= MEMCACHED_SUCCESS; server_count= memcached_server_count(memc); - result= (memcached_analysis_st*)calloc(memc->number_of_hosts, + result= (memcached_analysis_st*)calloc(memcached_server_count(memc), sizeof(memcached_analysis_st)); if (!result) @@ -79,12 +79,14 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, return NULL; } + result->root= memc; + for (x= 0; x < server_count; x++) { calc_largest_consumption(result, x, memc_stat[x].bytes); calc_oldest_node(result, x, memc_stat[x].uptime); calc_least_free_node(result, x, - memc_stat[x].limit_maxbytes, + memc_stat[x].limit_maxbytes, memc_stat[x].bytes); total_get_hits+= memc_stat[x].get_hits; @@ -98,3 +100,8 @@ memcached_analysis_st *memcached_analyze(memcached_st *memc, return result; } + +void memcached_analyze_free(memcached_analysis_st *ptr) +{ + free(ptr); +}