From 24aace42d7661d94ca874baf95450211a0674b83 Mon Sep 17 00:00:00 2001 From: Dmitriy Musatkin Date: Sun, 22 Oct 2023 22:52:52 -0700 Subject: [PATCH] rename --- include/aws/common/system_resource_util.h | 2 +- source/posix/system_resource_utils.c | 4 +++- source/windows/system_resource_utils.c | 3 ++- tests/system_resource_util_test.c | 3 +-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/aws/common/system_resource_util.h b/include/aws/common/system_resource_util.h index 8ab44d9ec..167a30d8a 100644 --- a/include/aws/common/system_resource_util.h +++ b/include/aws/common/system_resource_util.h @@ -22,7 +22,7 @@ struct aws_memory_usage { * Get memory usage for current process. * Raises AWS_ERROR_SYS_CALL_FAILURE on failure. */ -AWS_COMMON_API int aws_memory_usage_for_current_process(struct aws_memory_usage *memory_usage); +AWS_COMMON_API int aws_init_memory_usage_for_current_process(struct aws_memory_usage *memory_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 228ed1ac6..9d7834b19 100644 --- a/source/posix/system_resource_utils.c +++ b/source/posix/system_resource_utils.c @@ -6,10 +6,12 @@ #include #include +#include -int aws_memory_usage_for_current_process(struct aws_memory_usage *memory_usage) { +int aws_init_memory_usage_for_current_process(struct aws_memory_usage *memory_usage) { AWS_PRECONDITION(memory_usage); + AWS_ZERO_STRUCT(memory_usage); struct rusage usage; if (getrusage(RUSAGE_SELF, &usage)) { diff --git a/source/windows/system_resource_utils.c b/source/windows/system_resource_utils.c index b116f0a0b..1b5eadc7b 100644 --- a/source/windows/system_resource_utils.c +++ b/source/windows/system_resource_utils.c @@ -9,9 +9,10 @@ #include -int aws_memory_usage_for_current_process(struct aws_memory_usage *memory_usage) { +int aws_init_memory_usage_for_current_process(struct aws_memory_usage *memory_usage) { AWS_PRECONDITION(memory_usage); + AWS_ZERO_STRUCT(memory_usage); HANDLE hProcess = GetCurrentProcess(); PROCESS_MEMORY_COUNTERS pmc; diff --git a/tests/system_resource_util_test.c b/tests/system_resource_util_test.c index ffc06a11d..6e6f391f6 100644 --- a/tests/system_resource_util_test.c +++ b/tests/system_resource_util_test.c @@ -12,8 +12,7 @@ static int s_test_memory_usage_maxrss(struct aws_allocator *allocator, void *ctx (void)ctx; struct aws_memory_usage mu; - AWS_ZERO_STRUCT(mu); - ASSERT_SUCCESS(aws_memory_usage_for_current_process(&mu)); + ASSERT_SUCCESS(aws_init_memory_usage_for_current_process(&mu)); ASSERT_TRUE(mu.maxrss > 0);