35 #include <sys/resource.h>
36 #include <sys/types.h>
37 #include <sys/sysctl.h>
38 #include <uvm/uvm_extern.h>
56 int which[] = {CTL_VM, VM_LOADAVG};
60 avg[0] = (double)
info.ldavg[0] /
info.fscale;
61 avg[1] = (
double)
info.ldavg[1] /
info.fscale;
62 avg[2] = (double)
info.ldavg[2] /
info.fscale;
71 char int_buf[PATH_MAX];
79 mib[1] = KERN_PROC_ARGS;
81 mib[3] = KERN_PROC_PATHNAME;
84 if (sysctl(mib, 4, int_buf, &int_size,
NULL, 0))
103 int which[] = {CTL_VM, VM_UVMEXP};
113 #if defined(HW_PHYSMEM64)
115 int which[] = {CTL_HW, HW_PHYSMEM64};
118 int which[] = {CTL_HW, HW_PHYSMEM};
136 struct kinfo_proc2 *kinfo =
NULL;
139 int max_size =
sizeof(
struct kinfo_proc2);
142 page_size = getpagesize();
145 kd = kvm_open(
NULL,
NULL,
NULL, KVM_NO_FILES,
"kvm_open");
149 kinfo = kvm_getproc2(kd, KERN_PROC_PID,
pid, max_size, &nprocs);
152 *rss = kinfo->p_vm_rssize * page_size;
159 if (kd) kvm_close(kd);
168 static int which[] = {CTL_KERN, KERN_BOOTTIME};
175 *uptime = (double)(now -
info.tv_sec);
181 unsigned int ticks = (
unsigned int)sysconf(_SC_CLK_TCK);
182 unsigned int multiplier = ((
uint64_t)1000L / ticks);
183 unsigned int cur = 0;
192 size =
sizeof(model);
193 if (sysctlbyname(
"machdep.cpu_brand", &model, &
size,
NULL, 0) &&
194 sysctlbyname(
"hw.model", &model, &
size,
NULL, 0)) {
198 size =
sizeof(numcpus);
199 if (sysctlbyname(
"hw.ncpu", &numcpus, &
size,
NULL, 0))
204 size =
sizeof(cpuspeed);
205 if (sysctlbyname(
"machdep.tsc_freq", &cpuspeed, &
size,
NULL, 0))
210 if (cp_times ==
NULL)
213 if (sysctlbyname(
"kern.cp_time", cp_times, &
size,
NULL, 0))
216 *cpu_infos =
uv__malloc(numcpus *
sizeof(**cpu_infos));
223 for (
i = 0;
i < numcpus;
i++) {
224 cpu_info = &(*cpu_infos)[
i];
239 static int name[] = {CTL_KERN, KERN_ARND};
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 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 static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
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 fork const void static count static fd const char const char static newpath char char char static envp time
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc pid
uint64_t uv_get_total_memory(void)
void uv_loadavg(double avg[3])
uint64_t uv_get_free_memory(void)
int uv__random_sysctl(void *buf, size_t len)
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)
ssize_t uv__strscpy(char *d, const char *s, size_t n)
struct uv_cpu_times_s cpu_times
int uv__kqueue_init(uv_loop_t *loop)
void error(const char *msg)
char * uv__strdup(const char *s)
void * uv__malloc(size_t size)