7 #include <sys/resource.h>
9 bool Resource_Read(int id, double * value)
12 int err = getrusage(RUSAGE_SELF, &usage);
15 Log(LOGWARN, "Couldn't get resource information - %s", strerror(errno));
19 case RESOURCE_CPU_USER:
20 *value = usage.ru_utime.tv_sec + 1e-6*usage.ru_utime.tv_usec;
22 case RESOURCE_CPU_SYS:
23 *value = usage.ru_stime.tv_sec + 1e-6*usage.ru_stime.tv_usec;
26 Log(LOGWARN, "Unknown id %d", id);