Fix TPS measurement and add getTPS API

Previous implementation did not calculate TPS correctly.
Switch to a realistic rolling average and factor in std deviation as an extra reporting variable

Thanks to @chickeneer for the math wizardry for figuring this out!