mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
5bd0a17aa9
Fix up (some of the) windows compilation issues during merge of 1032b to main git-svn-id: file:///svn/toku/tokudb@8688 c7de825b-a66e-492c-adef-691d508d4ae1
55 lines
919 B
C
55 lines
919 B
C
#include <toku_portability.h>
|
|
#include <windows.h>
|
|
#include <stdint.h>
|
|
#include <inttypes.h>
|
|
#include <toku_os.h>
|
|
|
|
#define DO_MEMORY_INFO 1
|
|
|
|
#if DO_MEMORY_INFO
|
|
#include <psapi.h>
|
|
|
|
static int
|
|
get_memory_info(PROCESS_MEMORY_COUNTERS *meminfo) {
|
|
int r;
|
|
|
|
r = GetProcessMemoryInfo(GetCurrentProcess(), meminfo, sizeof *meminfo);
|
|
if (r == 0)
|
|
return GetLastError();
|
|
return 0;
|
|
}
|
|
|
|
#endif
|
|
|
|
int
|
|
toku_os_get_rss(int64_t *rss) {
|
|
int r;
|
|
#if DO_MEMORY_INFO
|
|
PROCESS_MEMORY_COUNTERS meminfo;
|
|
|
|
r = get_memory_info(&meminfo);
|
|
if (r == 0)
|
|
*rss = meminfo.WorkingSetSize;
|
|
#else
|
|
r = 0;
|
|
*rss = 0;
|
|
#endif
|
|
return r;
|
|
}
|
|
|
|
int
|
|
toku_os_get_max_rss(int64_t *maxrss) {
|
|
int r;
|
|
#if DO_MEMORY_INFO
|
|
PROCESS_MEMORY_COUNTERS meminfo;
|
|
|
|
r = get_memory_info(&meminfo);
|
|
if (r == 0)
|
|
*maxrss = meminfo.PeakWorkingSetSize;
|
|
#else
|
|
r = 0;
|
|
*maxrss = 0;
|
|
#endif
|
|
return r;
|
|
}
|
|
|