Anthony Barbier | c9afce5 | 2018-01-26 16:07:50 +0000 | [diff] [blame] | 1 | /* |
Michele Di Giorgio | d9eaf61 | 2020-07-08 11:12:57 +0100 | [diff] [blame] | 2 | * Copyright (c) 2018 Arm Limited. |
Anthony Barbier | c9afce5 | 2018-01-26 16:07:50 +0000 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: MIT |
| 5 | * |
| 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 7 | * of this software and associated documentation files (the "Software"), to |
| 8 | * deal in the Software without restriction, including without limitation the |
| 9 | * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 10 | * sell copies of the Software, and to permit persons to whom the Software is |
| 11 | * furnished to do so, subject to the following conditions: |
| 12 | * |
| 13 | * The above copyright notice and this permission notice shall be included in all |
| 14 | * copies or substantial portions of the Software. |
| 15 | * |
| 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 22 | * SOFTWARE. |
| 23 | */ |
| 24 | #ifndef ARM_COMPUTE_TEST_INSTRUMENTSMAP |
| 25 | #define ARM_COMPUTE_TEST_INSTRUMENTSMAP |
| 26 | |
| 27 | #include "Measurement.h" |
| 28 | |
| 29 | #include <vector> |
| 30 | |
| 31 | namespace arm_compute |
| 32 | { |
| 33 | namespace test |
| 34 | { |
| 35 | namespace framework |
| 36 | { |
| 37 | /** Generate common statistics for a set of measurements |
| 38 | */ |
| 39 | class InstrumentsStats |
| 40 | { |
| 41 | public: |
| 42 | /** Compute statistics for the passed set of measurements |
| 43 | * |
| 44 | * @param[in] measurements The measurements to process |
| 45 | */ |
| 46 | InstrumentsStats(const std::vector<Measurement> &measurements); |
| 47 | /** The measurement with the minimum value |
| 48 | */ |
| 49 | const Measurement &min() const |
| 50 | { |
| 51 | return *_min; |
| 52 | } |
| 53 | /** The measurement with the maximum value |
| 54 | */ |
| 55 | const Measurement &max() const |
| 56 | { |
| 57 | return *_max; |
| 58 | } |
| 59 | /** The median measurement |
| 60 | */ |
| 61 | const Measurement &median() const |
| 62 | { |
| 63 | return *_median; |
| 64 | } |
| 65 | /** The average of all the measurements |
| 66 | */ |
| 67 | const Measurement::Value &mean() const |
| 68 | { |
| 69 | return _mean; |
| 70 | } |
| 71 | /** The relative standard deviation of the measurements |
| 72 | */ |
| 73 | double relative_standard_deviation() const |
| 74 | { |
| 75 | return _stddev; |
| 76 | } |
| 77 | |
| 78 | private: |
| 79 | const Measurement *_min; |
| 80 | const Measurement *_max; |
| 81 | const Measurement *_median; |
| 82 | Measurement::Value _mean; |
| 83 | double _stddev; |
| 84 | }; |
| 85 | |
| 86 | } // namespace framework |
| 87 | } // namespace test |
| 88 | } // namespace arm_compute |
| 89 | #endif /* ARM_COMPUTE_TEST_INSTRUMENTSMAP */ |