diff options
author | Clement Courbet <courbet@google.com> | 2018-04-04 11:37:06 +0000 |
---|---|---|
committer | Clement Courbet <courbet@google.com> | 2018-04-04 11:37:06 +0000 |
commit | ac74acdefed9af2751d323bacef7ac47982957e8 (patch) | |
tree | 86fa1d51e6ad1bcf64c29d899c085e49f88ccf39 /llvm/tools/llvm-exegesis/lib/BenchmarkResult.h | |
parent | d152d55ab25be21ec8e5a162fce74f3bf7f8ed5c (diff) | |
download | bcm5719-llvm-ac74acdefed9af2751d323bacef7ac47982957e8.tar.gz bcm5719-llvm-ac74acdefed9af2751d323bacef7ac47982957e8.zip |
Re-land r329156 "Add llvm-exegesis tool."
Fixed to depend on and initialize the native target instead of X86.
llvm-svn: 329169
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkResult.h')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkResult.h | 53 |
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 |