This script explains how to check that a given function does not run slower than a given pystone rate. It first calculates the pystone ratio on your box.
This decoraone ratiot to use in production code, and would rather fit in functional or unit tests. This make performance tests portable to any box and fits performance regression tests you would want to run in unit tests.
DurationError is an AssertionError so it is reported as a failure in tests. local_pystone() is separated so you can call it once for many tests,and give it in the second argument of the decorator.
TOLERANCE is used to prevent failures for a busy CPU. (it's faster than using a 3-times test like hotshot does)