30 #include <sys/types.h>
31 #include <sys/resource.h>
32 #include <sys/sysctl.h>
33 #include <vm/vm_param.h>
60 char abspath[PATH_MAX * 2 + 1];
69 mib[2] = KERN_PROC_PATHNAME;
72 abspath_size =
sizeof abspath;
80 if (*
size > abspath_size)
91 size_t size =
sizeof(freecount);
93 if (sysctlbyname(
"vm.stats.vm.v_free_count", &freecount, &
size,
NULL, 0))
96 return (
uint64_t) freecount * sysconf(_SC_PAGESIZE);
103 int which[] = {CTL_HW, HW_PHYSMEM};
122 int which[] = {CTL_VM, VM_LOADAVG};
126 avg[0] = (double)
info.ldavg[0] /
info.fscale;
127 avg[1] = (
double)
info.ldavg[1] /
info.fscale;
128 avg[2] = (double)
info.ldavg[2] /
info.fscale;
133 struct kinfo_proc kinfo;
140 mib[2] = KERN_PROC_PID;
143 kinfo_size =
sizeof(kinfo);
148 page_size = getpagesize();
151 *rss = kinfo.kp_vm_rssize * page_size;
153 *rss = kinfo.ki_rssize * page_size;
163 r = clock_gettime(CLOCK_MONOTONIC, &
sp);
173 unsigned int ticks = (
unsigned int)sysconf(_SC_CLK_TCK),
174 multiplier = ((
uint64_t)1000L / ticks), cpuspeed, maxcpus,
177 const char* maxcpus_key;
178 const char* cptimes_key;
179 const char* model_key;
186 #if defined(__DragonFly__)
191 maxcpus_key =
"hw.ncpu";
192 cptimes_key =
"kern.cp_time";
194 maxcpus_key =
"kern.smp.maxcpus";
195 cptimes_key =
"kern.cp_times";
198 #if defined(__arm__) || defined(__aarch64__)
200 model_key =
"hw.machine";
203 model_key =
"hw.model";
205 size =
sizeof(cpuspeed);
206 if (sysctlbyname(
"hw.clockrate", &cpuspeed, &
size,
NULL, 0))
210 size =
sizeof(model);
211 if (sysctlbyname(model_key, &model, &
size,
NULL, 0))
214 size =
sizeof(numcpus);
215 if (sysctlbyname(
"hw.ncpu", &numcpus, &
size,
NULL, 0))
218 *cpu_infos =
uv__malloc(numcpus *
sizeof(**cpu_infos));
227 size =
sizeof(maxcpus);
228 if (sysctlbyname(maxcpus_key, &maxcpus, &
size,
NULL, 0)) {
236 if (cp_times ==
NULL) {
241 if (sysctlbyname(cptimes_key, cp_times, &
size,
NULL, 0)) {
247 for (
i = 0;
i < numcpus;
i++) {
248 cpu_info = &(*cpu_infos)[
i];
257 cpu_info->
speed = cpuspeed;
268 #if __FreeBSD__ >= 11
269 return sendmmsg(
fd, mmsg, vlen, 0);
271 return errno = ENOSYS, -1;
277 #if __FreeBSD__ >= 11
278 return recvmmsg(
fd, mmsg, vlen, 0 ,
NULL );
280 return errno = ENOSYS, -1;
RzBinInfo * info(RzBinFile *bf)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol which
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags long
uint64_t uv_get_total_memory(void)
void uv_loadavg(double avg[3])
uint64_t uv_get_free_memory(void)
int uv__sendmmsg(int fd, struct uv__mmsghdr *mmsg, unsigned int vlen)
int uv__recvmmsg(int fd, struct uv__mmsghdr *mmsg, unsigned int vlen)
int uv__platform_loop_init(uv_loop_t *loop)
int uv_uptime(double *uptime)
int uv_cpu_info(uv_cpu_info_t **cpu_infos, int *count)
uint64_t uv_get_constrained_memory(void)
void uv__platform_loop_delete(uv_loop_t *loop)
int uv_exepath(char *buffer, size_t *size)
int uv_resident_set_memory(size_t *rss)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
assert(limit<=UINT32_MAX/2)
struct uv_cpu_times_s cpu_times
int uv__kqueue_init(uv_loop_t *loop)
char * uv__strdup(const char *s)
void * uv__malloc(size_t size)
static const z80_opcode fd[]