#include "cmd_rusage.h" void *cmd_rusage(void *data) { char *ret = NULL; int fret=-1; const int buf_size = 128; char buf[buf_size+1]; struct rusage cur_proc_rusage; printf("RUSAGE\n"); fret = getrusage(RUSAGE_SELF, &cur_proc_rusage); if (fret<0) { ret = alloc_new_str("Cant get rusage mate\n"); } printf("USER %ld SYS %ld\n", cur_proc_rusage.ru_utime.tv_sec, cur_proc_rusage.ru_stime.tv_sec ); snprintf(buf, buf_size, "USER %ld SYS %ld\n", cur_proc_rusage.ru_utime.tv_sec, cur_proc_rusage.ru_stime.tv_sec ); ret = alloc_new_str(buf); return ret; }