32#include <mach/mach_init.h>
33#include <mach/shared_region.h>
47procInfo(
const char *filename,
const char *target)
54 FILE *
fp = fopen(filename,
"r");
56 while (
fp && !feof(
fp) && !done) {
57 if (fgets(line, 80,
fp)) {
60 sscanf(line,
format, &usage);
80 struct task_basic_info t_info;
81 mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
83 if (KERN_SUCCESS != task_info(mach_task_self(),
84 TASK_BASIC_INFO, (task_info_t)&t_info,
92 return (t_info.virtual_size - SHARED_REGION_SIZE) / 1024;
95 return procInfo(
"/proc/self/status",
"VmSize:");
Bitfield< 31, 29 > format
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
bool startswith(const char *s, const char *prefix)
Return true if 's' starts with the prefix string 'prefix'.
uint64_t memUsage()
Determine the simulator process' total virtual memory usage.
uint64_t procInfo(const char *filename, const char *target)