Clement Courbet | ac74acd | 2018-04-04 11:37:06 +0000 | [diff] [blame^] | 1 | //===-- BenchmarkResult.h ---------------------------------------*- C++ -*-===// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | /// |
| 10 | /// \file |
| 11 | /// Defines classes to represent measurements and serialize/deserialize them to |
| 12 | // Yaml. |
| 13 | /// |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
| 16 | #ifndef LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H |
| 17 | #define LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H |
| 18 | |
| 19 | #include "llvm/ADT/StringRef.h" |
| 20 | #include "llvm/Support/YAMLTraits.h" |
| 21 | #include <string> |
| 22 | #include <vector> |
| 23 | |
| 24 | namespace exegesis { |
| 25 | |
| 26 | struct AsmTemplate { |
| 27 | std::string Name; |
| 28 | }; |
| 29 | |
| 30 | struct BenchmarkMeasure { |
| 31 | std::string Key; |
| 32 | double Value; |
| 33 | std::string DebugString; |
| 34 | }; |
| 35 | |
| 36 | // The result of an instruction benchmark. |
| 37 | struct InstructionBenchmark { |
| 38 | AsmTemplate AsmTmpl; |
| 39 | std::string CpuName; |
| 40 | std::string LLVMTriple; |
| 41 | size_t NumRepetitions = 0; |
| 42 | std::vector<BenchmarkMeasure> Measurements; |
| 43 | std::string Error; |
| 44 | |
| 45 | static InstructionBenchmark readYamlOrDie(llvm::StringRef Filename); |
| 46 | |
| 47 | // Unfortunately this function is non const because of YAML traits. |
| 48 | void writeYamlOrDie(const llvm::StringRef Filename); |
| 49 | }; |
| 50 | |
| 51 | } // namespace exegesis |
| 52 | |
| 53 | #endif // LLVM_TOOLS_LLVM_EXEGESIS_BENCHMARKRESULT_H |