Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitriyMusatkin committed Oct 20, 2023
1 parent 257969b commit ecc110a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/aws/common/system_resource_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion source/posix/system_resource_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
12 changes: 7 additions & 5 deletions source/windows/system_resource_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,25 @@

#include <aws/common/system_resource_util.h>

#include <windows.h>
#include <psapi.h>
#include <windows.h>

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;
}

0 comments on commit ecc110a

Please sign in to comment.