24 #include <sys/types.h>
25 #include <sys/param.h>
26 #include <sys/resource.h>
27 #include <sys/sched.h>
29 #include <sys/sysctl.h>
51 int which[] = {CTL_VM, VM_LOADAVG};
55 avg[0] = (double)
info.ldavg[0] /
info.fscale;
56 avg[1] = (
double)
info.ldavg[1] /
info.fscale;
57 avg[2] = (double)
info.ldavg[2] /
info.fscale;
63 char **argsbuf =
NULL;
64 size_t argsbuf_size = 100U;
79 mib[1] = KERN_PROC_ARGS;
81 mib[3] = KERN_PROC_ARGV;
82 if (sysctl(mib,
ARRAY_SIZE(mib), argsbuf, &argsbuf_size,
NULL, 0) == 0) {
92 if (argsbuf[0] ==
NULL) {
98 exepath_size = strlen(argsbuf[0]);
99 if (*
size > exepath_size)
100 *
size = exepath_size;
116 int which[] = {CTL_VM, VM_UVMEXP};
127 int which[] = {CTL_HW, HW_PHYSMEM64};
143 struct kinfo_proc kinfo;
144 size_t page_size = getpagesize();
145 size_t size =
sizeof(
struct kinfo_proc);
150 mib[2] = KERN_PROC_PID;
152 mib[4] =
sizeof(
struct kinfo_proc);
158 *rss = kinfo.p_vm_rssize * page_size;
167 static int which[] = {CTL_KERN, KERN_BOOTTIME};
174 *uptime = (double)(now -
info.tv_sec);
180 unsigned int ticks = (
unsigned int)sysconf(_SC_CLK_TCK),
181 multiplier = ((
uint64_t)1000L / ticks), cpuspeed;
185 int which[] = {CTL_HW,HW_MODEL};
186 int percpu[] = {CTL_KERN,KERN_CPTIME2,0};
191 size =
sizeof(model);
195 which[1] = HW_NCPUONLINE;
196 size =
sizeof(numcpus);
200 *cpu_infos =
uv__malloc(numcpus *
sizeof(**cpu_infos));
207 which[1] = HW_CPUSPEED;
208 size =
sizeof(cpuspeed);
213 for (
i = 0;
i < numcpus;
i++) {
218 cpu_info = &(*cpu_infos)[
i];
227 cpu_info->
speed = cpuspeed;
234 for (j = 0; j <
i; j++)
RzBinInfo * info(RzBinFile *bf)
const lzma_allocator const uint8_t size_t uint8_t * out
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
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static static fork const void static count static fd const char const char static newpath char char char static envp time
uint64_t uv_get_total_memory(void)
void uv_loadavg(double avg[3])
uint64_t uv_get_free_memory(void)
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)
struct uv_cpu_times_s cpu_times
int uv__kqueue_init(uv_loop_t *loop)
void error(const char *msg)
void * uv__reallocf(void *ptr, size_t size)
char * uv__strdup(const char *s)
void * uv__malloc(size_t size)