blob: 6c238fd148402b87d430295fb3d20b1518a1fb73 [file] [log] [blame]
Clement Courbetac74acd2018-04-04 11:37:06 +00001//===-- 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
24namespace exegesis {
25
26struct AsmTemplate {
27 std::string Name;
28};
29
30struct BenchmarkMeasure {
31 std::string Key;
32 double Value;
33 std::string DebugString;
34};
35
36// The result of an instruction benchmark.
37struct 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