rtl_test: Refactoring and optimization for PPM error measurement.