Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include <psapi.h>
#else
#include <sys/resource.h>
#ifdef __APPLE__
#include <mach/mach.h>
#endif
#endif

namespace AgcDriver {
Expand Down Expand Up @@ -616,6 +619,11 @@ std::optional<std::uint64_t> ReadProcessPrivateBytes() {
counters.cb = sizeof(counters);
if (K32GetProcessMemoryInfo(GetCurrentProcess(), reinterpret_cast<PROCESS_MEMORY_COUNTERS*>(&counters), sizeof(counters)) == 0) return std::nullopt;
return static_cast<std::uint64_t>(counters.PrivateUsage);
#elif defined(__APPLE__)
task_vm_info_data_t info{};
mach_msg_type_number_t count = TASK_VM_INFO_COUNT;
if (task_info(mach_task_self(), TASK_VM_INFO, reinterpret_cast<task_info_t>(&info), &count) != KERN_SUCCESS || info.phys_footprint == 0) return std::nullopt;
return static_cast<std::uint64_t>(info.phys_footprint);
#else
std::FILE* status = std::fopen("/proc/self/status", "r");
if (status == nullptr) return std::nullopt;
Expand Down
Loading