include psapi.h instead of defining PROCESS_MEMORY_COUNTERS on windows

This commit is contained in:
Daan Leijen 2023-03-05 22:22:36 -08:00
parent 465eb81d30
commit b3f3a0de3b
2 changed files with 3 additions and 13 deletions

View File

@ -311,11 +311,13 @@ void _mi_heap_destroy_pages(mi_heap_t* heap) {
mi_heap_reset_pages(heap); mi_heap_reset_pages(heap);
} }
#if MI_TRACK_HEAP_DESTROY
static bool mi_cdecl mi_heap_track_block_free(const mi_heap_t* heap, const mi_heap_area_t* area, void* block, size_t block_size, void* arg) { static bool mi_cdecl mi_heap_track_block_free(const mi_heap_t* heap, const mi_heap_area_t* area, void* block, size_t block_size, void* arg) {
MI_UNUSED(heap); MI_UNUSED(area); MI_UNUSED(arg); MI_UNUSED(block_size); MI_UNUSED(heap); MI_UNUSED(area); MI_UNUSED(arg); MI_UNUSED(block_size);
mi_track_free_size(block,mi_usable_size(block)); mi_track_free_size(block,mi_usable_size(block));
return true; return true;
} }
#endif
void mi_heap_destroy(mi_heap_t* heap) { void mi_heap_destroy(mi_heap_t* heap) {
mi_assert(heap != NULL); mi_assert(heap != NULL);

View File

@ -465,6 +465,7 @@ mi_msecs_t _mi_clock_end(mi_msecs_t start) {
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#include <psapi.h>
static mi_msecs_t filetime_msecs(const FILETIME* ftime) { static mi_msecs_t filetime_msecs(const FILETIME* ftime) {
ULARGE_INTEGER i; ULARGE_INTEGER i;
@ -474,19 +475,6 @@ static mi_msecs_t filetime_msecs(const FILETIME* ftime) {
return msecs; return msecs;
} }
typedef struct _PROCESS_MEMORY_COUNTERS {
DWORD cb;
DWORD PageFaultCount;
SIZE_T PeakWorkingSetSize;
SIZE_T WorkingSetSize;
SIZE_T QuotaPeakPagedPoolUsage;
SIZE_T QuotaPagedPoolUsage;
SIZE_T QuotaPeakNonPagedPoolUsage;
SIZE_T QuotaNonPagedPoolUsage;
SIZE_T PagefileUsage;
SIZE_T PeakPagefileUsage;
} PROCESS_MEMORY_COUNTERS;
typedef PROCESS_MEMORY_COUNTERS* PPROCESS_MEMORY_COUNTERS;
typedef BOOL (WINAPI *PGetProcessMemoryInfo)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD); typedef BOOL (WINAPI *PGetProcessMemoryInfo)(HANDLE, PPROCESS_MEMORY_COUNTERS, DWORD);
static PGetProcessMemoryInfo pGetProcessMemoryInfo = NULL; static PGetProcessMemoryInfo pGetProcessMemoryInfo = NULL;