duration of operation? basic approach:
start = clock();
operation();
stop = clock();
variability
precision
overhead
measure multiple times:
loop N times:
start = clock();
operation();
stop = clock();
endloop;
inflate impact of operation:
start = clock();
loop N times:
operation();
endloop;
stop = clock();
additional overheads
experiment duration
real-time with fixed period X? naive approach:
loop:
action();
sleep(X);
endloop;
... is not sufficient:duration of action(), errors in sleep()
account for deviations from perfect timing:
target = clock();
loop:
action();
target += X;
sleep(target - clock());
endloop;