projects
/
m6w6
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
|
inline
| side by side (from parent 1:
9868238
)
lp:794709
author
Brian Aker
<brian@tangent.org>
Fri, 10 Jun 2011 22:24:54 +0000
(15:24 -0700)
committer
Brian Aker
<brian@tangent.org>
Fri, 10 Jun 2011 22:24:54 +0000
(15:24 -0700)
libmemcached/analyze.cc
patch
|
blob
|
history
diff --git
a/libmemcached/analyze.cc
b/libmemcached/analyze.cc
index 7dcbf8cb3bcc255b601a3bfbfbdb021b1c1809d8..ec534a3b4c9f67467e5ed568f257a6a3d5c2bf6f 100644
(file)
--- a/
libmemcached/analyze.cc
+++ b/
libmemcached/analyze.cc
@@
-55,7
+55,7
@@
static void calc_hit_ratio(memcached_analysis_st *result,
return;
}
return;
}
- double temp=
(double) (total_get_hits/total_get_cmds)
;
+ double temp=
double(total_get_hits) / total_get_cmds
;
result->pool_hit_ratio= temp * 100;
}
result->pool_hit_ratio= temp * 100;
}
@@
-68,12
+68,15
@@
memcached_analysis_st *memcached_analyze(memcached_st *memc,
uint32_t server_count, x;
memcached_analysis_st *result;
uint32_t server_count, x;
memcached_analysis_st *result;
+ if (not memc or not memc_stat)
+ return NULL;
+
*error= MEMCACHED_SUCCESS;
server_count= memcached_server_count(memc);
result= (memcached_analysis_st*)calloc(memcached_server_count(memc),
sizeof(memcached_analysis_st));
*error= MEMCACHED_SUCCESS;
server_count= memcached_server_count(memc);
result= (memcached_analysis_st*)calloc(memcached_server_count(memc),
sizeof(memcached_analysis_st));
- if (
!
result)
+ if (
not
result)
{
*error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
return NULL;
{
*error= MEMCACHED_MEMORY_ALLOCATION_FAILURE;
return NULL;