Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Oct 23, 2023
1 parent 31624a6 commit fb1912b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ if (WIN32)
endif ()

list(APPEND PLATFORM_DEFINES WINDOWS_KERNEL_LIB=${WINDOWS_KERNEL_LIB})
# PSAPI_VERSION=1 is needed to support GetProcessMemoryInfo on both pre and
# post Win7 OS's.
list(APPEND PLATFORM_DEFINES PSAPI_VERSION=1)
list(APPEND PLATFORM_LIBS BCrypt ${WINDOWS_KERNEL_LIB} Ws2_32 Shlwapi Psapi)
else ()
Expand Down
4 changes: 2 additions & 2 deletions include/aws/common/system_resource_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ AWS_PUSH_SANE_WARNING_LEVEL

AWS_EXTERN_C_BEGIN

struct aws_memory_usage {
struct aws_memory_usage_stats {
size_t maxrss; /* max resident set size in kilobytes since program start */
size_t page_faults; /* num of page faults since program start */

Expand All @@ -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_init_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_stats *memory_usage);

AWS_EXTERN_C_END
AWS_POP_SANE_WARNING_LEVEL
Expand Down
2 changes: 1 addition & 1 deletion source/posix/system_resource_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <sys/resource.h>

int aws_init_memory_usage_for_current_process(struct aws_memory_usage *memory_usage) {
int aws_init_memory_usage_for_current_process(struct aws_memory_usage_stats *memory_usage) {
AWS_PRECONDITION(memory_usage);

AWS_ZERO_STRUCT(*memory_usage);
Expand Down
2 changes: 1 addition & 1 deletion source/windows/system_resource_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <psapi.h>

int aws_init_memory_usage_for_current_process(struct aws_memory_usage *memory_usage) {
int aws_init_memory_usage_for_current_process(struct aws_memory_usage_stats *memory_usage) {
AWS_PRECONDITION(memory_usage);

AWS_ZERO_STRUCT(*memory_usage);
Expand Down
4 changes: 2 additions & 2 deletions tests/system_resource_util_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ static int s_test_memory_usage_maxrss(struct aws_allocator *allocator, void *ctx
(void)allocator;
(void)ctx;

struct aws_memory_usage mu;
struct aws_memory_usage_stats mu;
ASSERT_SUCCESS(aws_init_memory_usage_for_current_process(&mu));

ASSERT_TRUE(mu.maxrss > 0);

return 0;
}

AWS_TEST_CASE(test_memory_usage_maxrss, s_test_memory_usage_maxrss)
AWS_TEST_CASE(test_memory_usage_maxrss, s_test_memory_usage_maxrss)

0 comments on commit fb1912b

Please sign in to comment.