diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2015-08-30 20:49:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2015-09-09 09:53:00 +0100 |
commit | d32b2ca15bb2840ccf53d98a7088a3f01f8496a6 (patch) | |
tree | 1eb201cc8cb00f5b4dce0c368f8c30e69fc2897b | |
parent | 9971ee98e480dd0dc8d7216281afe2308f392534 (diff) |
core: Make geometric mean robust for large number of tests
Since using a multiplication of each test result can quickly exhaust the
floating point range, convert it to a logarithmic addition.
-rwxr-xr-x | ezbench.sh | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -406,7 +406,7 @@ do # finish with the geometric mean (when we have multiple tests) if [ $t -gt 1 ]; then - fpsALL=$(awk '{r = 1; for(i=1; i<=NF; i++) { r *= $i } print exp(log(r) / NF) }' <<< $fpsALL) + fpsALL=$(awk '{r=0; for(i=1; i<=NF; i++) { r += log($i) } print exp(r / NF) }' <<< $fpsALL) if [ -z "${testPrevFps[-1]}" ]; then testPrevFps[-1]=$fpsALL fi |