Skip to content

Commit

Permalink
more tests with bench.m
Browse files Browse the repository at this point in the history
  • Loading branch information
sbashford committed Oct 27, 2023
1 parent d64a226 commit 4bc33aa
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions toolbox/+ihn/+example/bench.m
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
function bench
window = ihn.createWindowForPropixx();
durationSeconds = 0.5;
iterations = 10;
durationSeconds = 0.25;
iterations = 5;
candidate(1).name = 'trustGPU';
candidate(1).f = @trustGPU;
candidate(2).name = 'trustCPU';
candidate(2).f = @trustCPU;
candidate(3).name = 'blocking';
candidate(3).f = @blocking;
candidate(4).name = 'flippingWhen';
candidate(4).f = @flippingWhen;
comparisons = 5;
for j = 1:comparisons
stream = RandStream('mt19937ar', 'Seed', 'Shuffle');
Expand Down Expand Up @@ -50,8 +52,12 @@ function trustCPU(window, durationSeconds, frameRateHz)
end
end

function blocking(~, durationSeconds, ~)
WaitSecs(durationSeconds);
function blocking(~, durationSeconds, frameRateHz)
WaitSecs(durationSeconds - 0.25/frameRateHz);
end

function flippingWhen(window, durationSeconds, frameRateHz)
Screen('Flip', window.pointer, GetSecs() + durationSeconds - 1/frameRateHz);
end

function metrics(name, elapsed, target)
Expand Down

0 comments on commit 4bc33aa

Please sign in to comment.