drothlis/stb-tester — pull request #31 by drimer (2013-06-17 17:31:58+00:00)
Title: Performance measurements

`stbt run` drops frames from the video stream it's processing if the CPU
isn't powerful enough to run the `wait_for_match` algorithm in real
time. On a reasonably modern quad-core machine we get about 5 frames per
second.

Sometimes, though, we want to process every single frame of video, so
that we can more accurately measure the responsiveness of the
system-under-test to button presses, and to measure the smoothness of
animations like a highlighted menu selection sliding horizontally or
vertically.

If we process every frame of video we will very quickly fall behind the
live video stream, and we would need huge buffers to run the entire test
script this way. So the idea is to have a python context manager:

with stbt.process_all_frames():
# do your measurements here.
# this line runs in normal (frame-dropping) mode.