server: fix some typo and support auto set cache size

This commit is contained in:
Nick Peng
2023-03-21 21:06:32 +08:00
parent bf68385d0e
commit 4f2867b7f4
14 changed files with 121 additions and 42 deletions

View File

@@ -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') {