#include
#include
#include
#include
Copyright By PowCoder代写 加微信 powcoder
void print_usage(void) {
struct rusage r;
if (getrusage(RUSAGE_SELF, &r) < 0) {
exit(EXIT_FAILURE);
fprintf(stderr, "%lds %ldms (%s)\n", r.ru_utime.tv_sec, r.ru_utime.tv_usec,
"user CPU time used");
fprintf(stderr, "%lds %ldms (%s)\n", r.ru_stime.tv_sec, r.ru_stime.tv_sec,
"system CPU time used");
fprintf(stderr, "%ld (%s)\n", r.ru_maxrss, "maximum resident set size");
fprintf(stderr, "%ld (%s)\n", r.ru_ixrss, "integral shared memory size");
fprintf(stderr, "%ld (%s)\n", r.ru_idrss, "integral unshared data size");
fprintf(stderr, "%ld (%s)\n", r.ru_isrss, "integral unshared stack size");
fprintf(stderr, "%ld (%s)\n", r.ru_minflt, "page reclaims (soft page faults)");
fprintf(stderr, "%ld (%s)\n", r.ru_majflt, "page faults (hard page faults)");
fprintf(stderr, "%ld (%s)\n", r.ru_nswap, "swaps");
fprintf(stderr, "%ld (%s)\n", r.ru_inblock, "block input operations");
fprintf(stderr, "%ld (%s)\n", r.ru_oublock, "block output operations");
fprintf(stderr, "%ld (%s)\n", r.ru_msgsnd, "IPC messages sent");
fprintf(stderr, "%ld (%s)\n", r.ru_msgrcv, "IPC messages received");
fprintf(stderr, "%ld (%s)\n", r.ru_nsignals, "signals received");
fprintf(stderr, "%ld (%s)\n", r.ru_nvcsw, "voluntary context switches");
fprintf(stderr, "%ld (%s)\n", r.ru_nivcsw, "involuntary context switches");
int main(void) {
print_usage();
return EXIT_SUCCESS;
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com