projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
semver: 1.0 -> 1
[awesomized/libmemcached]
/
contrib
/
bin
/
memaslap
/
ms_setting.c
diff --git
a/contrib/bin/memaslap/ms_setting.c
b/contrib/bin/memaslap/ms_setting.c
index 38a5cbbcb62697e25a3f76c491f577c8ee281dcb..7cbdb53d30261a931315facef9e97ae5136ed0a8 100644
(file)
--- a/
contrib/bin/memaslap/ms_setting.c
+++ b/
contrib/bin/memaslap/ms_setting.c
@@
-183,32
+183,28
@@
static void ms_get_serverlist(char *str) {
/**
* used to get the CPU count of the current system
*
/**
* used to get the CPU count of the current system
*
- * @return return the cpu count if
get, else return EXIT_FAILURE
+ * @return return the cpu count if
possible, else return 1
*/
static uint32_t ms_get_cpu_count() {
*/
static uint32_t ms_get_cpu_count() {
-#ifdef HAVE__SC_NPROCESSORS_ONLN
- return sysconf(_SC_NPROCESSORS_CONF);
-
-#else
-# ifdef HAVE_CPU_SET_T
- int cpu_count = 0;
+#ifdef HAVE_CPU_SET_T
+ unsigned cpu_count = 0;
cpu_set_t cpu_set;
sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set);
cpu_set_t cpu_set;
sched_getaffinity(0, sizeof(cpu_set_t), &cpu_set);
- for (
int
i = 0; i < (sizeof(cpu_set_t) * 8); i++) {
+ for (
unsigned
i = 0; i < (sizeof(cpu_set_t) * 8); i++) {
if (CPU_ISSET(i, &cpu_set)) {
cpu_count++;
}
}
return cpu_count;
if (CPU_ISSET(i, &cpu_set)) {
cpu_count++;
}
}
return cpu_count;
-
-# endif
+#elif defined HAVE__SC_NPROCESSORS_ONLN
+ return sysconf(_SC_NPROCESSORS_CONF);
#endif
/* the system with one cpu at least */
#endif
/* the system with one cpu at least */
- return
EXIT_FAILURE
;
+ return
1
;
} /* ms_get_cpu_count */
/**
} /* ms_get_cpu_count */
/**