X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached_stats.c;h=decf22b614c8a864634c3abdaabba95d1ba1e31e;hb=e1944ccd4d1e65f4192783fa9c564c9b747bb618;hp=43574be576c4671e03bfe63102caad351cc16ed8;hpb=da3a1b9ec585148509e4e7006d4c48ec7cf5ecef;p=m6w6%2Flibmemcached diff --git a/lib/memcached_stats.c b/lib/memcached_stats.c index 43574be5..decf22b6 100644 --- a/lib/memcached_stats.c +++ b/lib/memcached_stats.c @@ -93,27 +93,27 @@ static void set_data(memcached_stat_st *stat, char *key, char *value) } else if (!memcmp("connection_structures", key, strlen("connection_structures"))) { - //stat->connection_structures= strtol(value, (char **)NULL, 10); + stat->connection_structures= strtol(value, (char **)NULL, 10); } else if (!memcmp("cmd_get", key, strlen("cmd_get"))) { - //stat->cmd_get= strtoll(value, (char **)NULL, 10); + stat->cmd_get= strtoll(value, (char **)NULL, 10); } else if (!memcmp("cmd_set", key, strlen("cmd_set"))) { - //stat->cmd_set= strtoll(value, (char **)NULL, 10); + stat->cmd_set= strtoll(value, (char **)NULL, 10); } else if (!memcmp("get_hits", key, strlen("get_hits"))) { - //stat->get_hits= strtoll(value, (char **)NULL, 10); + stat->get_hits= strtoll(value, (char **)NULL, 10); } else if (!memcmp("get_misses", key, strlen("get_misses"))) { - //stat->get_misses= (uint64_t)strtoll(value, (char **)NULL, 10); + stat->get_misses= (uint64_t)strtoll(value, (char **)NULL, 10); } else if (!memcmp("evictions", key, strlen("evictions"))) { - //stat->evictions= (uint64_t)strtoll(value, (char **)NULL, 10); + stat->evictions= (uint64_t)strtoll(value, (char **)NULL, 10); } else if (!memcmp("bytes_read", key, strlen("bytes_read"))) { @@ -125,7 +125,7 @@ static void set_data(memcached_stat_st *stat, char *key, char *value) } else if (!memcmp("limit_maxbytes", key, strlen("limit_maxbytes"))) { - //stat->limit_maxbytes= strtol(value, (char **)NULL, 10); + stat->limit_maxbytes= strtol(value, (char **)NULL, 10); } else if (!memcmp("threads", key, strlen("threads"))) { @@ -153,14 +153,10 @@ char *memcached_stat_get_value(memcached_st *ptr, memcached_stat_st *stat, snprintf(buffer, SMALL_STRING_LEN,"%s", stat->version); else if (!memcmp("pointer_size", key, strlen("pointer_size"))) snprintf(buffer, SMALL_STRING_LEN,"%u", stat->pointer_size); - else if (!memcmp("rusage_user_seconds", key, strlen("rusage_user_seconds"))) - snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_user_seconds); - else if (!memcmp("rusage_user_microseconds", key, strlen("rusage_user_microseconds"))) - snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_user_microseconds); - else if (!memcmp("rusage_system_seconds", key, strlen("rusage_system_seconds"))) - snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_system_seconds); - else if (!memcmp("rusage_system_microseconds", key, strlen("rusage_system_microseconds"))) - snprintf(buffer, SMALL_STRING_LEN,"%u", stat->rusage_system_microseconds); + else if (!memcmp("rusage_user", key, strlen("rusage_user"))) + snprintf(buffer, SMALL_STRING_LEN,"%u.%u", stat->rusage_user_seconds, stat->rusage_user_microseconds); + else if (!memcmp("rusage_system", key, strlen("rusage_system"))) + snprintf(buffer, SMALL_STRING_LEN,"%u.%u", stat->rusage_system_seconds, stat->rusage_system_microseconds); else if (!memcmp("curr_items", key, strlen("curr_items"))) snprintf(buffer, SMALL_STRING_LEN,"%u", stat->curr_items); else if (!memcmp("total_items", key, strlen("total_items"))) @@ -269,7 +265,7 @@ memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_retur free(stats); return NULL; } - memset(stats, 0, sizeof(memcached_st)*(ptr->number_of_hosts)); + memset(stats, 0, sizeof(memcached_stat_st)*(ptr->number_of_hosts)); rc= MEMCACHED_SUCCESS; for (x= 0; x < ptr->number_of_hosts; x++)