From ecc110a0e79291ab101121236ad80f1334b94926 Mon Sep 17 00:00:00 2001 From: Dmitriy Musatkin Date: Fri, 20 Oct 2023 16:04:31 -0700 Subject: [PATCH] lint --- include/aws/common/system_resource_util.h | 2 +- source/posix/system_resource_utils.c | 3 ++- source/windows/system_resource_utils.c | 12 +++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/include/aws/common/system_resource_util.h b/include/aws/common/system_resource_util.h index db63608f8..df1c456bc 100644 --- a/include/aws/common/system_resource_util.h +++ b/include/aws/common/system_resource_util.h @@ -13,13 +13,13 @@ AWS_EXTERN_C_BEGIN struct aws_resource_usage { size_t maxrss; + size_t page_faults; size_t _reserved[8]; }; AWS_COMMON_API int aws_resource_usage_for_current_process(struct aws_resource_usage *resource_usage); - AWS_EXTERN_C_END AWS_POP_SANE_WARNING_LEVEL diff --git a/source/posix/system_resource_utils.c b/source/posix/system_resource_utils.c index 042d4a182..cc2774643 100644 --- a/source/posix/system_resource_utils.c +++ b/source/posix/system_resource_utils.c @@ -20,6 +20,7 @@ int aws_resource_usage_for_current_process(struct aws_resource_usage *ru) { ru->maxrss = usage.ru_maxrss / 1024; #else ru->maxrss = usage.ru_maxrss; -#endif +#endif + ru->page_faults = usage.ru_majflt; return AWS_OP_SUCCESS; } diff --git a/source/windows/system_resource_utils.c b/source/windows/system_resource_utils.c index 00c0e7502..0e786430f 100644 --- a/source/windows/system_resource_utils.c +++ b/source/windows/system_resource_utils.c @@ -5,23 +5,25 @@ #include -#include #include +#include -int aws_resource_usage_for_current_process(struct aws_resource_usage *resource_usage) { +int aws_resource_usage_for_current_process(struct aws_resource_usage *ru) { AWS_PRECONDITION(resource_usage); - HANDLE hProcess = GetCurrentProcess();; + HANDLE hProcess = GetCurrentProcess(); + ; PROCESS_MEMORY_COUNTERS pmc; BOOL ret = GetProcessMemoryInfo(hProcess, &pmc, sizeof(pmc)); - CloseHandle( hProcess ); - + CloseHandle(hProcess); + if (!ret) { return aws_raise_error(AWS_ERROR_SYS_CALL_FAILURE); } ru->maxrss = pmc.PeakWorkingSetSize; + ru->page_faults = pmc.PageFaultCount; return AWS_OP_SUCCESS; }