rtl_test: Refactoring and optimization for PPM error measurement.

Part 2. Thanks to Kyle Keen.