[vim] add snippet for timing
This commit is contained in:
parent
5fa44eda0a
commit
6c911c38dc
@ -108,3 +108,12 @@ snippet .
|
||||
[${1}]${2}
|
||||
snippet un
|
||||
unsigned
|
||||
snippet time_me
|
||||
{
|
||||
struct timeval prev_tv, cur_tv, diff_tv;
|
||||
gettimeofday(&prev_tv, NULL);
|
||||
${1:function();}
|
||||
gettimeofday(&cur_tv, NULL);
|
||||
timersub(&cur_tv, &prev_tv, &diff_tv);
|
||||
printf("${2:function} take %d us \n", diff_tv.tv_usec);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user