Kernel API function prototype:
#include <linux/time.h>
struct timeval {
__kernel_time_t tv_sec; /* seconds */
__kernel_suseconds_t tv_usec; /* microseconds */
};
do_gettimeofday(struct timeval *tv)
Code:
unsigned long timeuse;
struct timeval tv_start, tv_end;
do_gettimeofday(&tv_start);
/* do something */
do_gettimeofday(&tv_end);
timeuse = (tv_end.tv_sec - tv_start.tv_sec) * 1000;
timeuse += (tv_end.tv_usec - tv_start.tv_usec) / 1000;
pr_debug("timeuse: %lu ms\n", timeuse);