summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Yen <steve.yen@gmail.com>2009-03-25 12:16:01 -0700
committerSteve Yen <steve.yen@gmail.com>2009-03-25 12:16:01 -0700
commit7dda2c4301b47a0b02d094bbfdeeb77cf01e76ff (patch)
tree3427b1b47eefe38cfc4a64e3d3b4e060e15f6bf0
parent45f4a130fa66da8000fef6b1a63a0ee1ac469472 (diff)
downloadmemcached-7dda2c4301b47a0b02d094bbfdeeb77cf01e76ff.tar.gz
stats reset also clears cas_hits/badval/misses
-rwxr-xr-xt/stats.t21
-rw-r--r--thread.c3
2 files changed, 23 insertions, 1 deletions
diff --git a/t/stats.t b/t/stats.t
index 28f9133..93ee639 100755
--- a/t/stats.t
+++ b/t/stats.t
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 74;
+use Test::More tests => 89;
use FindBin qw($Bin);
use lib "$Bin/lib";
use MemcachedTest;
@@ -152,3 +152,22 @@ is(1024, $settings->{'maxconns'});
is('NULL', $settings->{'domain_socket'});
is('on', $settings->{'evictions'});
is('yes', $settings->{'cas_enabled'});
+
+print $sock "stats reset\r\n";
+is(scalar <$sock>, "RESET\r\n", "good stats reset");
+
+my $stats = mem_stats($sock);
+is(0, $stats->{'cmd_get'});
+is(0, $stats->{'cmd_set'});
+is(0, $stats->{'get_hits'});
+is(0, $stats->{'get_misses'});
+is(0, $stats->{'delete_misses'});
+is(0, $stats->{'delete_hits'});
+is(0, $stats->{'incr_misses'});
+is(0, $stats->{'incr_hits'});
+is(0, $stats->{'decr_misses'});
+is(0, $stats->{'decr_hits'});
+is(0, $stats->{'cas_misses'});
+is(0, $stats->{'cas_hits'});
+is(0, $stats->{'cas_badval'});
+is(0, $stats->{'evictions'});
diff --git a/thread.c b/thread.c
index d01fe78..ec37681 100644
--- a/thread.c
+++ b/thread.c
@@ -473,6 +473,7 @@ void threadlocal_stats_reset(void) {
threads[ii].stats.delete_misses = 0;
threads[ii].stats.incr_misses = 0;
threads[ii].stats.decr_misses = 0;
+ threads[ii].stats.cas_misses = 0;
threads[ii].stats.bytes_read = 0;
threads[ii].stats.bytes_written = 0;
@@ -482,6 +483,8 @@ void threadlocal_stats_reset(void) {
threads[ii].stats.slab_stats[sid].delete_hits = 0;
threads[ii].stats.slab_stats[sid].incr_hits = 0;
threads[ii].stats.slab_stats[sid].decr_hits = 0;
+ threads[ii].stats.slab_stats[sid].cas_hits = 0;
+ threads[ii].stats.slab_stats[sid].cas_badval = 0;
}
pthread_mutex_unlock(&threads[ii].stats.mutex);