diff options
Diffstat (limited to 'llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp')
-rw-r--r-- | llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp | 49 |
1 files changed, 3 insertions, 46 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp index 189add6..f84ebd2 100644 --- a/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp +++ b/llvm/tools/llvm-exegesis/lib/BenchmarkResult.cpp @@ -9,6 +9,7 @@ #include "BenchmarkResult.h" #include "BenchmarkRunner.h" #include "Error.h" +#include "ValidationEvent.h" #include "llvm/ADT/STLExtras.h" #include "llvm/ADT/ScopeExit.h" #include "llvm/ADT/StringRef.h" @@ -198,7 +199,7 @@ struct CustomMappingTraits<std::map<exegesis::ValidationEvent, int64_t>> { static void inputOne(IO &Io, StringRef KeyStr, std::map<exegesis::ValidationEvent, int64_t> &VI) { Expected<exegesis::ValidationEvent> Key = - exegesis::stringToValidationEvent(KeyStr); + exegesis::getValidationEventByName(KeyStr); if (!Key) { Io.setError("Key is not a valid validation event"); return; @@ -208,7 +209,7 @@ struct CustomMappingTraits<std::map<exegesis::ValidationEvent, int64_t>> { static void output(IO &Io, std::map<exegesis::ValidationEvent, int64_t> &VI) { for (auto &IndividualVI : VI) { - Io.mapRequired(exegesis::validationEventToString(IndividualVI.first), + Io.mapRequired(exegesis::getValidationEventName(IndividualVI.first), IndividualVI.second); } } @@ -441,49 +442,5 @@ bool operator==(const BenchmarkMeasure &A, const BenchmarkMeasure &B) { std::tie(B.Key, B.PerInstructionValue, B.PerSnippetValue); } -const char *validationEventToString(ValidationEvent VE) { - switch (VE) { - case exegesis::ValidationEvent::InstructionRetired: - return "instructions-retired"; - case exegesis::ValidationEvent::L1DCacheLoadMiss: - return "l1d-cache-load-misses"; - case exegesis::ValidationEvent::L1DCacheStoreMiss: - return "l1d-cache-store-misses"; - case exegesis::ValidationEvent::L1ICacheLoadMiss: - return "l1i-cache-load-misses"; - case exegesis::ValidationEvent::DataTLBLoadMiss: - return "data-tlb-load-misses"; - case exegesis::ValidationEvent::DataTLBStoreMiss: - return "data-tlb-store-misses"; - case exegesis::ValidationEvent::InstructionTLBLoadMiss: - return "instruction-tlb-load-misses"; - case exegesis::ValidationEvent::BranchPredictionMiss: - return "branch-prediction-misses"; - } - llvm_unreachable("Unhandled exegesis::ValidationEvent enum"); -} - -Expected<ValidationEvent> stringToValidationEvent(StringRef Input) { - if (Input == "instructions-retired") - return exegesis::ValidationEvent::InstructionRetired; - else if (Input == "l1d-cache-load-misses") - return exegesis::ValidationEvent::L1DCacheLoadMiss; - else if (Input == "l1d-cache-store-misses") - return exegesis::ValidationEvent::L1DCacheStoreMiss; - else if (Input == "l1i-cache-load-misses") - return exegesis::ValidationEvent::L1ICacheLoadMiss; - else if (Input == "data-tlb-load-misses") - return exegesis::ValidationEvent::DataTLBLoadMiss; - else if (Input == "data-tlb-store-misses") - return exegesis::ValidationEvent::DataTLBStoreMiss; - else if (Input == "instruction-tlb-load-misses") - return exegesis::ValidationEvent::InstructionTLBLoadMiss; - else if (Input == "branch-prediction-misses") - return exegesis::ValidationEvent::BranchPredictionMiss; - else - return make_error<StringError>("Invalid validation event string", - errc::invalid_argument); -} - } // namespace exegesis } // namespace llvm |