I have the following assembly program, and as a sort of test, I'd like to see how the 1B-increment function takes. What would be the most accurate way to time this?
SYS_EXIT = 60
LOOP_MAX = 1000000000
.globl _start
loop:
# do a billion increments
mov $0, %eax
_loop:
inc %eax
cmp $LOOP_MAX, %eax
jne _loop
ret
_start:
# start time
call loop
# printf("It took %.8f to run", end_time - start_time)
mov $0, %edi
mov $SYS_EXIT, %eax
syscall