标签:
#include <time.h> /* return current time in milliseconds */ long get_current_ms() { struct timespec res; clock_gettime(CLOCK_REALTIME, &res); return 1000 * res.tv_sec + res.tv_nsec / 1e6; }
long start = get_current_ms(); // start time // YOUR CODE HERE long end = get_current_ms(); // end time long delta = end - start; // time your code took to exec in ms
标签:
原文地址:http://my.oschina.net/jerikc/blog/513325