/* Tom Gall (tom.gall@linaro.org / tom_gall@mac.com) * Copyright Linaro 2014 * Released under the terms and conditions of the license documented in the LICENSE file */ #include #include int opencl_collect_timestamp(struct timespec *timestamp) { if (clock_gettime(CLOCK_MONOTONIC,timestamp)) { return -1; } return 0; } void opencl_print_time_interval(struct timespec *start, struct timespec *end) { unsigned long long startMsec, endMsec; startMsec = start->tv_sec * 1000000; startMsec += start->tv_nsec/1000; if (start->tv_nsec % 1000 >= 500) { ++startMsec; } endMsec = end->tv_sec * 1000000; endMsec += end->tv_nsec/1000; if (end->tv_nsec % 1000 >= 500) { ++endMsec; } printf("Interval took %lld microseconds\n",endMsec - startMsec); }