summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
diff options
context:
space:
mode:
authorClement Courbet <courbet@google.com>2018-04-04 08:13:32 +0000
committerClement Courbet <courbet@google.com>2018-04-04 08:13:32 +0000
commit7287b2c1ec669791df8b1c704e2457338f6bee47 (patch)
tree43bc8f285b995f2f9bae92ce122bf0425c55a718 /llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
parent4f98e0bc030dacf65af981968a8f4f8234f5f32f (diff)
downloadbcm5719-llvm-7287b2c1ec669791df8b1c704e2457338f6bee47.tar.gz
bcm5719-llvm-7287b2c1ec669791df8b1c704e2457338f6bee47.zip
Add llvm-exegesis tool.
Summary: [llvm-exegesis][RFC] Automatic Measurement of Instruction Latency/Uops This is the code corresponding to the RFC "llvm-exegesis Automatic Measurement of Instruction Latency/Uops". The RFC is available on the LLVM mailing lists as well as the following document for easier reading: https://docs.google.com/document/d/1QidaJMJUyQdRrFKD66vE1_N55whe0coQ3h1GpFzz27M/edit?usp=sharing Subscribers: mgorny, gchatelet, orwant, llvm-commits Differential Revision: https://reviews.llvm.org/D44519 llvm-svn: 329156
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkResult.h')
-rw-r--r--llvm/tools/llvm-exegesis/lib/BenchmarkResult.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
new file mode 100644
index 00000000000..6c238fd1484
--- /dev/null
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.h
@@ -0,0 +1,53 @@
+//===-- BenchmarkResult.h ---------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+///
+/// \file
+/// Defines classes to represent measurements and serialize/deserialize them to
+// Yaml.
+///
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H
+#define LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H
+
+#include "llvm/ADT/StringRef.h"
+#include "llvm/Support/YAMLTraits.h"
+#include <string>
+#include <vector>
+
+namespace exegesis {
+
+struct AsmTemplate {
+ std::string Name;
+};
+
+struct BenchmarkMeasure {
+ std::string Key;
+ double Value;
+ std::string DebugString;
+};
+
+// The result of an instruction benchmark.
+struct InstructionBenchmark {
+ AsmTemplate AsmTmpl;
+ std::string CpuName;
+ std::string LLVMTriple;
+ size_t NumRepetitions = 0;
+ std::vector<BenchmarkMeasure> Measurements;
+ std::string Error;
+
+ static InstructionBenchmark readYamlOrDie(llvm::StringRef Filename);
+
+ // Unfortunately this function is non const because of YAML traits.
+ void writeYamlOrDie(const llvm::StringRef Filename);
+};
+
+} // namespace exegesis
+
+#endif // LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H
OpenPOWER on IntegriCloud