diff options
| author | Clement Courbet <courbet@google.com> | 2018-09-26 08:37:21 +0000 |
|---|---|---|
| committer | Clement Courbet <courbet@google.com> | 2018-09-26 08:37:21 +0000 |
| commit | 684a5f675380ad3e97fbb9b6e6858ee2348f85b3 (patch) | |
| tree | ab9c1cecf65cca691bda95a5b312a2ed27179708 /llvm/unittests/tools/llvm-exegesis | |
| parent | cc525e7b8d62231c3825630a4c1e384031d7b41d (diff) | |
| download | bcm5719-llvm-684a5f675380ad3e97fbb9b6e6858ee2348f85b3.tar.gz bcm5719-llvm-684a5f675380ad3e97fbb9b6e6858ee2348f85b3.zip | |
[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
Diffstat (limited to 'llvm/unittests/tools/llvm-exegesis')
| -rw-r--r-- | llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp | 24 | ||||
| -rw-r--r-- | llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp | 19 |
2 files changed, 25 insertions, 18 deletions
diff --git a/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp b/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp index ecdb7d2a274..5d583a08951 100644 --- a/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/ClusteringTest.cpp @@ -26,13 +26,18 @@ TEST(ClusteringTest, Clusters3D) { std::vector<InstructionBenchmark> Points(6); // Cluster around (x=0, y=1, z=2): points {0, 3}. - Points[0].Measurements = {{"x", 0.01, ""}, {"y", 1.02, ""}, {"z", 1.98, "A"}}; - Points[3].Measurements = {{"x", -0.01, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; + Points[0].Measurements = { + {"x", 0.01, 0.0, ""}, {"y", 1.02, 0.0, ""}, {"z", 1.98, 0.0, "A"}}; + Points[3].Measurements = { + {"x", -0.01, 0.0, ""}, {"y", 1.02, 0.0, ""}, {"z", 1.98, 0.0, ""}}; // Cluster around (x=1, y=1, z=2): points {1, 4}. - Points[1].Measurements = {{"x", 1.01, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; - Points[4].Measurements = {{"x", 0.99, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; + Points[1].Measurements = { + {"x", 1.01, 0.0, ""}, {"y", 1.02, 0.0, ""}, {"z", 1.98, 0.0, ""}}; + Points[4].Measurements = { + {"x", 0.99, 0.0, ""}, {"y", 1.02, 0.0, ""}, {"z", 1.98, 0.0, ""}}; // Cluster around (x=0, y=0, z=0): points {5}, marked as noise. - Points[5].Measurements = {{"x", 0.0, ""}, {"y", 0.01, ""}, {"z", -0.02, ""}}; + Points[5].Measurements = { + {"x", 0.0, 0.0, ""}, {"y", 0.01, 0.0, ""}, {"z", -0.02, 0.0, ""}}; // Error cluster: points {2} Points[2].Error = "oops"; @@ -64,8 +69,9 @@ TEST(ClusteringTest, Clusters3D) { TEST(ClusteringTest, Clusters3D_InvalidSize) { std::vector<InstructionBenchmark> Points(6); - Points[0].Measurements = {{"x", 0.01, ""}, {"y", 1.02, ""}, {"z", 1.98, ""}}; - Points[1].Measurements = {{"y", 1.02, ""}, {"z", 1.98, ""}}; + Points[0].Measurements = { + {"x", 0.01, 0.0, ""}, {"y", 1.02, 0.0, ""}, {"z", 1.98, 0.0, ""}}; + Points[1].Measurements = {{"y", 1.02, 0.0, ""}, {"z", 1.98, 0.0, ""}}; auto Error = InstructionBenchmarkClustering::create(Points, 2, 0.25).takeError(); ASSERT_TRUE((bool)Error); @@ -74,8 +80,8 @@ TEST(ClusteringTest, Clusters3D_InvalidSize) { TEST(ClusteringTest, Clusters3D_InvalidOrder) { std::vector<InstructionBenchmark> Points(6); - Points[0].Measurements = {{"x", 0.01, ""}, {"y", 1.02, ""}}; - Points[1].Measurements = {{"y", 1.02, ""}, {"x", 1.98, ""}}; + Points[0].Measurements = {{"x", 0.01, 0.0, ""}, {"y", 1.02, 0.0, ""}}; + Points[1].Measurements = {{"y", 1.02, 0.0, ""}, {"x", 1.98, 0.0, ""}}; auto Error = InstructionBenchmarkClustering::create(Points, 2, 0.25).takeError(); ASSERT_TRUE((bool)Error); diff --git a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp index bdac559276b..67e8d2c5bc9 100644 --- a/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp +++ b/llvm/unittests/tools/llvm-exegesis/X86/BenchmarkResultTest.cpp @@ -28,7 +28,8 @@ using ::testing::Property; 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 @@ TEST(BenchmarkResultTest, WriteToAndReadFromDisk) { 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, WriteToAndReadFromDisk) { } } -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 |

