#include #include "concurrency.h" void walltime_start(walltime_t* start) { clock_gettime(CLOCK_MONOTONIC, start); } double walltime_elapsed(const walltime_t* start) { walltime_t finish; clock_gettime(CLOCK_MONOTONIC, &finish); double elapsed = (finish.tv_sec - start->tv_sec); elapsed += (finish.tv_nsec - start->tv_nsec) / 1000000000.0; return elapsed; } int concurrency_cpu_count() { return sysconf(_SC_NPROCESSORS_ONLN); }