summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-05-24 12:41:02 +0000
committerClement Courbet <courbet@google.com>2018-05-24 12:41:02 +0000
commitae8ae5dc78b8c6950b57b37706dfc37131d4d913 (patch)
treeb2db1517539526a5e3653bc38c881607eb1eaa0f /llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
parent13f8a77d79ed48da17ee61e0ba1357418ad2d706 (diff)
downloadbcm5719-llvm-ae8ae5dc78b8c6950b57b37706dfc37131d4d913.tar.gz
bcm5719-llvm-ae8ae5dc78b8c6950b57b37706dfc37131d4d913.zip
[llvm-exegesis] Analysis: Show value extents.
Summary: Screenshot attached in phabricator. Reviewers: gchatelet Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D47318 llvm-svn: 333181
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkResult.h')
-rw-r--r--llvm/tools/llvm-exegesis/lib/BenchmarkResult.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
index 3a7d241dbd0..4362df86df6 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
@@ -18,6 +18,7 @@
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/YAMLTraits.h"
+#include <limits>
#include <string>
#include <vector>
@@ -61,6 +62,29 @@ struct InstructionBenchmark {
void writeYamlOrDie(const llvm::StringRef Filename);
};
+//------------------------------------------------------------------------------
+// Utilities to work with Benchmark measures.
+
+// A class that measures stats over benchmark measures.
+class BenchmarkMeasureStats {
+public:
+ void push(const BenchmarkMeasure &BM);
+
+ double avg() const {
+ assert(NumValues);
+ return SumValues / NumValues;
+ }
+ double min() const { return MinValue; }
+ double max() const { return MaxValue; }
+
+private:
+ std::string Key;
+ double SumValues = 0.0;
+ int NumValues = 0;
+ double MaxValue = std::numeric_limits<double>::min();
+ double MinValue = std::numeric_limits<double>::max();
+};
+
} // namespace exegesis
#endif // LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H
OpenPOWER on IntegriCloud