-#define _POSIX_C_SOURCE 200809L
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
static unsigned long long tic() {
struct timespec ts;
- if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) {
+ if (clock_gettime(CLOCK_REALTIME, &ts) < 0) {
fprintf(stderr, "bench: clock_gettime failed: %s\n", strerror(errno));
return 0;
}
f = fopen("/proc/self/smaps", "rb");
if (f) while (fgets(buf, sizeof buf, f)) {
- if (sscanf(buf, "%*lx-%*lx %*s %*lx %x:%x %*lu %*s", &maj, &min)==2)
+ if (sscanf(buf, "%*x-%*x %*s %*x %x:%x %*u %*s", &maj, &min)==2)
in_heap = (!maj && !min && !strstr(buf, "---p") && (strstr(buf, "[heap]") || !strchr(buf, '[')));
if (in_heap) {
if (sscanf(buf, "Size: %lu", &l)==1) vm_size += l;