From: Date: Wed, 13 May 2009 21:40:19 +0000 (-0700) Subject: Cachegrind to test and fix for cache misses X-Git-Tag: 0.29-2~5 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=1d3aea18eadb5a2ca6893ab860bb5dbace09b94a;p=awesomized%2Flibmemcached Cachegrind to test and fix for cache misses --- diff --git a/libmemcached/memcached_fetch.c b/libmemcached/memcached_fetch.c index 07bfdda9..e9939890 100644 --- a/libmemcached/memcached_fetch.c +++ b/libmemcached/memcached_fetch.c @@ -8,7 +8,7 @@ char *memcached_fetch(memcached_st *ptr, char *key, size_t *key_length, { memcached_result_st *result_buffer= &ptr->result; - if (ptr->flags & MEM_USE_UDP) + unlikely (ptr->flags & MEM_USE_UDP) { *error= MEMCACHED_NOT_SUPPORTED; return NULL; @@ -44,7 +44,7 @@ memcached_result_st *memcached_fetch_result(memcached_st *ptr, { memcached_server_st *server; - if (ptr->flags & MEM_USE_UDP) + unlikely (ptr->flags & MEM_USE_UDP) { *error= MEMCACHED_NOT_SUPPORTED; return NULL; diff --git a/libmemcached/memcached_get.c b/libmemcached/memcached_get.c index 9a33fc69..05b317a6 100644 --- a/libmemcached/memcached_get.c +++ b/libmemcached/memcached_get.c @@ -27,7 +27,7 @@ char *memcached_get_by_key(memcached_st *ptr, uint32_t dummy_flags; memcached_return dummy_error; - if (ptr->flags & MEM_USE_UDP) + unlikely (ptr->flags & MEM_USE_UDP) { *error= MEMCACHED_NOT_SUPPORTED; return NULL; @@ -128,7 +128,7 @@ memcached_return memcached_mget_by_key(memcached_st *ptr, unsigned int master_server_key= (unsigned int)-1; /* 0 is a valid server id! */ bool is_master_key_set= false; - if (ptr->flags & MEM_USE_UDP) + unlikely (ptr->flags & MEM_USE_UDP) return MEMCACHED_NOT_SUPPORTED; LIBMEMCACHED_MEMCACHED_MGET_START(); diff --git a/libmemcached/memcached_stats.c b/libmemcached/memcached_stats.c index 791c00d9..d5ec819f 100644 --- a/libmemcached/memcached_stats.c +++ b/libmemcached/memcached_stats.c @@ -351,7 +351,7 @@ memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_retur memcached_return rc; memcached_stat_st *stats; - if (ptr->flags & MEM_USE_UDP) + unlikely (ptr->flags & MEM_USE_UDP) { *error= MEMCACHED_NOT_SUPPORTED; return NULL; diff --git a/libmemcached/memcached_verbosity.c b/libmemcached/memcached_verbosity.c index 8dc9df31..43132786 100644 --- a/libmemcached/memcached_verbosity.c +++ b/libmemcached/memcached_verbosity.c @@ -24,7 +24,7 @@ memcached_return memcached_verbosity(memcached_st *ptr, unsigned int verbosity) continue; } - if (ptr->flags & MEM_USE_UDP) + unlikely (ptr->flags & MEM_USE_UDP) continue; rrc= memcached_response(&ptr->hosts[x], buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, NULL); diff --git a/tests/Makefile.am b/tests/Makefile.am index cb0bc2a0..5e51f666 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -75,6 +75,11 @@ clients: valgrind: libtool --mode=execute valgrind --leak-check=yes --show-reachable=yes testapp +cachegrind: + rm cachegrind.out.* + libtool --mode=execute valgrind --tool=cachegrind --branch-sim=yes testapp + cg_annotate cachegrind.out.* --auto=yes > /tmp/calgrind.out + test-no-outputdiff: testapp ./testapp > /dev/null @echo "Test completed"