Revert "(SIGAR-188) implement mem actual free/used on Windows"
This reverts commit e4fda73a29
.
This commit is contained in:
parent
b40013def1
commit
54ef26bab6
|
@ -170,28 +170,10 @@ typedef enum {
|
||||||
SC_STATUS_PROCESS_INFO = 0
|
SC_STATUS_PROCESS_INFO = 0
|
||||||
} SC_STATUS_TYPE;
|
} SC_STATUS_TYPE;
|
||||||
|
|
||||||
typedef struct _PERFORMANCE_INFORMATION {
|
|
||||||
DWORD cb;
|
|
||||||
SIZE_T CommitTotal;
|
|
||||||
SIZE_T CommitLimit;
|
|
||||||
SIZE_T CommitPeak;
|
|
||||||
SIZE_T PhysicalTotal;
|
|
||||||
SIZE_T PhysicalAvailable;
|
|
||||||
SIZE_T SystemCache;
|
|
||||||
SIZE_T KernelTotal;
|
|
||||||
SIZE_T KernelPaged;
|
|
||||||
SIZE_T KernelNonpaged;
|
|
||||||
SIZE_T PageSize;
|
|
||||||
DWORD HandleCount;
|
|
||||||
DWORD ProcessCount;
|
|
||||||
DWORD ThreadCount;
|
|
||||||
} PERFORMANCE_INFORMATION, *PPERFORMANCE_INFORMATION;
|
|
||||||
|
|
||||||
#ifndef ERROR_DATATYPE_MISMATCH
|
#ifndef ERROR_DATATYPE_MISMATCH
|
||||||
#define ERROR_DATATYPE_MISMATCH 1629L
|
#define ERROR_DATATYPE_MISMATCH 1629L
|
||||||
#endif
|
#endif
|
||||||
#else
|
|
||||||
#include <psapi.h>
|
|
||||||
#endif /* _MSC_VER */
|
#endif /* _MSC_VER */
|
||||||
|
|
||||||
#include <iprtrmib.h>
|
#include <iprtrmib.h>
|
||||||
|
@ -455,8 +437,6 @@ typedef BOOL (CALLBACK *psapi_enum_processes)(DWORD *,
|
||||||
DWORD,
|
DWORD,
|
||||||
DWORD *);
|
DWORD *);
|
||||||
|
|
||||||
typedef BOOL (CALLBACK *psapi_get_perf_info)(PPERFORMANCE_INFORMATION, DWORD);
|
|
||||||
|
|
||||||
/* winsta.dll */
|
/* winsta.dll */
|
||||||
typedef BOOLEAN (CALLBACK *winsta_query_info)(HANDLE,
|
typedef BOOLEAN (CALLBACK *winsta_query_info)(HANDLE,
|
||||||
ULONG,
|
ULONG,
|
||||||
|
@ -533,7 +513,6 @@ typedef struct {
|
||||||
SIGAR_DLLFUNC(psapi, enum_modules);
|
SIGAR_DLLFUNC(psapi, enum_modules);
|
||||||
SIGAR_DLLFUNC(psapi, enum_processes);
|
SIGAR_DLLFUNC(psapi, enum_processes);
|
||||||
SIGAR_DLLFUNC(psapi, get_module_name);
|
SIGAR_DLLFUNC(psapi, get_module_name);
|
||||||
SIGAR_DLLFUNC(psapi, get_perf_info);
|
|
||||||
|
|
||||||
sigar_dll_func_t end;
|
sigar_dll_func_t end;
|
||||||
} sigar_psapi_t;
|
} sigar_psapi_t;
|
||||||
|
|
|
@ -341,7 +341,6 @@ static sigar_psapi_t sigar_psapi = {
|
||||||
{ "EnumProcessModules", NULL },
|
{ "EnumProcessModules", NULL },
|
||||||
{ "EnumProcesses", NULL },
|
{ "EnumProcesses", NULL },
|
||||||
{ "GetModuleFileNameExA", NULL },
|
{ "GetModuleFileNameExA", NULL },
|
||||||
{ "GetPerformanceInfo", NULL },
|
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -631,14 +630,9 @@ char *sigar_os_error_string(sigar_t *sigar, int err)
|
||||||
#define sigar_GlobalMemoryStatusEx \
|
#define sigar_GlobalMemoryStatusEx \
|
||||||
sigar->kernel.memory_status.func
|
sigar->kernel.memory_status.func
|
||||||
|
|
||||||
#define sigar_GetPerformanceInfo \
|
|
||||||
sigar->psapi.get_perf_info.func
|
|
||||||
|
|
||||||
SIGAR_DECLARE(int) sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
SIGAR_DECLARE(int) sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
||||||
{
|
{
|
||||||
sigar_uint64_t kern = 0;
|
|
||||||
DLLMOD_INIT(kernel, TRUE);
|
DLLMOD_INIT(kernel, TRUE);
|
||||||
DLLMOD_INIT(psapi, FALSE);
|
|
||||||
|
|
||||||
if (sigar_GlobalMemoryStatusEx) {
|
if (sigar_GlobalMemoryStatusEx) {
|
||||||
MEMORYSTATUSEX memstat;
|
MEMORYSTATUSEX memstat;
|
||||||
|
@ -651,14 +645,6 @@ SIGAR_DECLARE(int) sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
||||||
|
|
||||||
mem->total = memstat.ullTotalPhys;
|
mem->total = memstat.ullTotalPhys;
|
||||||
mem->free = memstat.ullAvailPhys;
|
mem->free = memstat.ullAvailPhys;
|
||||||
|
|
||||||
if (sigar_GetPerformanceInfo) {
|
|
||||||
PERFORMANCE_INFORMATION info;
|
|
||||||
if (sigar_GetPerformanceInfo(&info, sizeof(info))) {
|
|
||||||
kern = info.SystemCache;
|
|
||||||
kern *= sigar->pagesize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
MEMORYSTATUS memstat;
|
MEMORYSTATUS memstat;
|
||||||
|
@ -669,8 +655,8 @@ SIGAR_DECLARE(int) sigar_mem_get(sigar_t *sigar, sigar_mem_t *mem)
|
||||||
|
|
||||||
mem->used = mem->total - mem->free;
|
mem->used = mem->total - mem->free;
|
||||||
|
|
||||||
mem->actual_free = mem->free + kern;
|
mem->actual_free = mem->free;
|
||||||
mem->actual_used = mem->used - kern;
|
mem->actual_used = mem->used;
|
||||||
|
|
||||||
sigar_mem_calc_ram(sigar, mem);
|
sigar_mem_calc_ram(sigar, mem);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue