[llvm-exegesis] Output the unscaled value as well as the scaled one.
Summary: See PR38936 for context.
Reviewers: gchatelet
Subscribers: tschuett, llvm-commits
Differential Revision: https://reviews.llvm.org/D52500
llvm-svn: 343081
diff --git a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
index bdac559..67e8d2c 100644
--- a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
+++ b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp
@@ -28,7 +28,8 @@
namespace exegesis {
bool operator==(const BenchmarkMeasure &A, const BenchmarkMeasure &B) {
- return std::tie(A.Key, A.Value) == std::tie(B.Key, B.Value);
+ return std::tie(A.Key, A.PerInstructionValue, A.PerSnippetValue) ==
+ std::tie(B.Key, B.PerInstructionValue, B.PerSnippetValue);
}
static std::string Dump(const llvm::MCInst &McInst) {
@@ -75,8 +76,8 @@
ToDisk.CpuName = "cpu_name";
ToDisk.LLVMTriple = "llvm_triple";
ToDisk.NumRepetitions = 1;
- ToDisk.Measurements.push_back(BenchmarkMeasure{"a", 1, "debug a"});
- ToDisk.Measurements.push_back(BenchmarkMeasure{"b", 2, ""});
+ ToDisk.Measurements.push_back(BenchmarkMeasure{"a", 1, 1, "debug a"});
+ ToDisk.Measurements.push_back(BenchmarkMeasure{"b", 2, 2, ""});
ToDisk.Error = "error";
ToDisk.Info = "info";
@@ -123,12 +124,12 @@
}
}
-TEST(BenchmarkResultTest, BenchmarkMeasureStats) {
- BenchmarkMeasureStats Stats;
- Stats.push(BenchmarkMeasure{"a", 0.5, "debug a"});
- Stats.push(BenchmarkMeasure{"a", 1.5, "debug a"});
- Stats.push(BenchmarkMeasure{"a", -1.0, "debug a"});
- Stats.push(BenchmarkMeasure{"a", 0.0, "debug a"});
+TEST(BenchmarkResultTest, PerInstructionStats) {
+ PerInstructionStats Stats;
+ Stats.push(BenchmarkMeasure{"a", 0.5, 0.0, "debug a"});
+ Stats.push(BenchmarkMeasure{"a", 1.5, 0.0, "debug a"});
+ Stats.push(BenchmarkMeasure{"a", -1.0, 0.0, "debug a"});
+ Stats.push(BenchmarkMeasure{"a", 0.0, 0.0, "debug a"});
EXPECT_EQ(Stats.min(), -1.0);
EXPECT_EQ(Stats.max(), 1.5);
EXPECT_EQ(Stats.avg(), 0.25); // (0.5+1.5-1.0+0.0) / 4