diff options
author | Joel Liang <joel.liang@arm.com> | 2017-11-21 16:50:53 +0800 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:41:58 +0000 |
commit | 5b73ce1428d32a2c817562b3447840dc6d0e71b8 (patch) | |
tree | 8cc573b6e55827430261d623d95d12cfd70e00ff /tests/framework/instruments/Measurement.h | |
parent | c5114d33293e3124c04655a6f50df5394c424fd6 (diff) | |
download | ComputeLibrary-5b73ce1428d32a2c817562b3447840dc6d0e71b8.tar.gz |
APPBROWSER-313: medium value and relative standard deviation
Calculate the median value and relative standard deviation for better performance comparison.
Change-Id: I433baa0b030f988d661777b2cbf8bf10c70f39d4
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/111638
Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'tests/framework/instruments/Measurement.h')
-rw-r--r-- | tests/framework/instruments/Measurement.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/framework/instruments/Measurement.h b/tests/framework/instruments/Measurement.h index 8a1ec9cb14..9fb75d7b99 100644 --- a/tests/framework/instruments/Measurement.h +++ b/tests/framework/instruments/Measurement.h @@ -92,6 +92,44 @@ struct Measurement return b; } + /** Subtract with another value and return the result + * + * @param[in] b Other value + * + * @return Result of the stored value - b + */ + Value operator-(Value b) const + { + if(is_floating_point) + { + b.v.floating_point -= v.floating_point; + } + else + { + b.v.integer -= v.integer; + } + return b; + } + + /** Multiple with another value and return the result + * + * @param[in] b Other value + * + * @return Result of the stored value * b + */ + Value operator*(Value b) const + { + if(is_floating_point) + { + b.v.floating_point *= v.floating_point; + } + else + { + b.v.integer *= v.integer; + } + return b; + } + /** Return the stored value divided by an integer. * * @param[in] b Integer to divide the value by. @@ -149,6 +187,18 @@ struct Measurement } } + static double relative_standard_deviation(const Value &variance, const Value &mean) + { + if(variance.is_floating_point) + { + return 100.0 * sqrt(variance.v.floating_point) / mean.v.floating_point; + } + else + { + return 100.0 * sqrt(static_cast<double>(variance.v.integer)) / mean.v.integer; + } + } + /** Stored value */ union { |