server: fix some typo and support auto set cache size
This commit is contained in:
11
src/util.c
11
src/util.c
@@ -50,6 +50,7 @@
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <unwind.h>
|
||||
#include <sys/sysinfo.h>
|
||||
|
||||
#define TMP_BUFF_LEN_32 32
|
||||
|
||||
@@ -1225,6 +1226,16 @@ void get_compiled_time(struct tm *tm)
|
||||
tm->tm_sec = sec;
|
||||
}
|
||||
|
||||
unsigned long get_system_mem_size(void)
|
||||
{
|
||||
struct sysinfo memInfo;
|
||||
sysinfo (&memInfo);
|
||||
long long totalMem = memInfo.totalram;
|
||||
totalMem *= memInfo.mem_unit;
|
||||
|
||||
return totalMem;
|
||||
}
|
||||
|
||||
int is_numeric(const char *str)
|
||||
{
|
||||
while (*str != '\0') {
|
||||
|
||||
Reference in New Issue
Block a user