diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-11 10:43:02 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-10-21 16:10:45 +0300 |
commit | 9adc78134c261d5e236faac3b537e1cfd937880a (patch) | |
tree | b9a12b9fe8ddc5e828e588efc04187148e042e77 /render-test/metadata.hpp | |
parent | f41f274ca16032da8c41186b2181f0c800d777df (diff) | |
download | qtlocation-mapboxgl-9adc78134c261d5e236faac3b537e1cfd937880a.tar.gz |
[test runner] Threshold for memory metrics
Diffstat (limited to 'render-test/metadata.hpp')
-rw-r--r-- | render-test/metadata.hpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/render-test/metadata.hpp b/render-test/metadata.hpp index c26fde1d19..20cc440fd4 100644 --- a/render-test/metadata.hpp +++ b/render-test/metadata.hpp @@ -49,12 +49,19 @@ struct FileSizeProbe { struct MemoryProbe { MemoryProbe() = default; - MemoryProbe(size_t peak_, size_t allocations_) - : peak(peak_) - , allocations(allocations_) {} + MemoryProbe(size_t peak_, size_t allocations_) : peak(peak_), allocations(allocations_), tolerance(0.0f) {} size_t peak; size_t allocations; + float tolerance; + + static std::tuple<bool, float> checkPeak(const MemoryProbe& expected, const MemoryProbe& actual) { + return checkValue(expected.peak, actual.peak, actual.tolerance); + } + + static std::tuple<bool, float> checkAllocations(const MemoryProbe& expected, const MemoryProbe& actual) { + return checkValue(expected.allocations, actual.allocations, actual.tolerance); + } }; struct NetworkProbe { |