Measure time more accurately

This commit is contained in:
2020-01-21 14:06:58 -05:00
parent c6fcb4aa66
commit 83ca059295

View File

@@ -29,10 +29,10 @@ unsigned long long _start(float *init_a)
while(1) while(1)
{ {
__asm__ volatile ("mrs %0, cntpct_el0" : "=r" (start)); __asm__ volatile ("isb\n\rmrs %0, cntpct_el0" : "=r" (start));
fs_load(init_a, 1); fs_load(init_a, 1);
for(i = 0; i < 8; i++) fs_routine(); for(i = 0; i < 8; i++) fs_routine();
__asm__ volatile ("mrs %0, cntpct_el0" : "=r" (end)); __asm__ volatile ("isb\n\rmrs %0, cntpct_el0" : "=r" (end));
if(2 * end - start - 64 > 0) if(2 * end - start - 64 > 0)
{ {
@@ -41,6 +41,7 @@ unsigned long long _start(float *init_a)
} }
} }
__asm__ volatile ("mrs %0, cntpct_el0" : "=r" (report));
return end - start; __asm__ volatile ("isb\n\rmrs %0, cntpct_el0" : "=r" (report));
return report - end;
} }