userspace
#include <sys/time.h> { struct timeval tv_begin, tv_end; gettimeofday(&tv_begin, NULL); //func gettimeofday(&tv_end, NULL); printf("func time %d ", tv_end.tv_usec - tv_begin.tv_usec); }
kernel
#include <linux/time.h> { struct timeval tx0, tx1; struct timespec c0, c1 do_gettimeofday(&tx0);<br> getrawmonotonic(&c0); //func do_gettimeofday(&tx1); getrawmonotonic(&c1); printk("tx1 - tx0: %ld %ld ", (tx1.tv_usec - tx0.tv_usec), (c1.tv_nsec - c0.tv_nsec)); }