| 44 | } |
| 45 | |
| 46 | void print_rusage_diff(struct rusage r1, struct rusage r2) { |
| 47 | printf("****** CPU user time %.2lf s, sys time %.2lf s\n", |
| 48 | (TIMEVAL_TO_SEC(r2.ru_utime) - TIMEVAL_TO_SEC(r1.ru_utime)), |
| 49 | (TIMEVAL_TO_SEC(r2.ru_stime) - TIMEVAL_TO_SEC(r1.ru_stime))); |
| 50 | |
| 51 | printf( |
| 52 | "****** Mem RSS %.2lf MB, soft page fault %ld - hard page fault %ld, voluntary context switches %ld - involuntary %ld\n", |
| 53 | (double) (r2.ru_maxrss - r1.ru_maxrss) / (1024.0), |
| 54 | (r2.ru_minflt - r1.ru_minflt), (r2.ru_majflt - r1.ru_majflt), |
| 55 | (r2.ru_nvcsw - r1.ru_nvcsw), (r2.ru_nivcsw - r1.ru_nivcsw)); |
| 56 | } |
| 57 | |
| 58 | void workload0(allocator alloc, const char *allocator_name) { |
| 59 | /* single size allocation */ |