summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2018-11-19 13:28:36 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2018-11-19 13:28:36 +0000
commit8e315b66c261553d6023732fe112f55d62118a70 (patch)
treebca6e47f645b6185e9892ac59acb22483bae8427 /llvm/tools
parent666d855fbbd0f7ccd6a4e7908c189fe19fb5472e (diff)
downloadbcm5719-llvm-8e315b66c261553d6023732fe112f55d62118a70.tar.gz
bcm5719-llvm-8e315b66c261553d6023732fe112f55d62118a70.zip
[llvm-exegesis] Move InstructionBenchmarkClustering::isNeighbour() into header
Summary: Old: (D54390) ``` Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs): 7432.421721 task-clock (msec) # 1.000 CPUs utilized ( +- 0.15% ) ... 7.4336 +- 0.0115 seconds time elapsed ( +- 0.15% ) ``` New: ``` Performance counter stats for './bin/llvm-exegesis -mode=analysis -analysis-epsilon=100000 -benchmarks-file=/tmp/benchmarks.yaml -analysis-inconsistencies-output-file=/tmp/clusters.html' (10 runs): 6569.936144 task-clock (msec) # 1.000 CPUs utilized ( +- 0.22% ) ... 6.5711 +- 0.0143 seconds time elapsed ( +- 0.22% ) ``` And another -12%. You'd think it would be `inline`d anyway, but no! :) Reviewers: courbet, MaskRay, RKSimon, gchatelet, john.brawn Reviewed By: courbet, MaskRay Subscribers: tschuett, llvm-commits Differential Revision: https://reviews.llvm.org/D54393 llvm-svn: 347203
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-exegesis/lib/Clustering.cpp11
-rw-r--r--llvm/tools/llvm-exegesis/lib/Clustering.h9
2 files changed, 8 insertions, 12 deletions
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.cpp b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
index df45de31990..360966a9478 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.cpp
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.cpp
@@ -49,17 +49,6 @@ void InstructionBenchmarkClustering::rangeQuery(
}
}
-bool InstructionBenchmarkClustering::isNeighbour(
- const std::vector<BenchmarkMeasure> &P,
- const std::vector<BenchmarkMeasure> &Q) const {
- double DistanceSquared = 0.0;
- for (size_t I = 0, E = P.size(); I < E; ++I) {
- const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue;
- DistanceSquared += Diff * Diff;
- }
- return DistanceSquared <= EpsilonSquared_;
-}
-
InstructionBenchmarkClustering::InstructionBenchmarkClustering(
const std::vector<InstructionBenchmark> &Points,
const double EpsilonSquared)
diff --git a/llvm/tools/llvm-exegesis/lib/Clustering.h b/llvm/tools/llvm-exegesis/lib/Clustering.h
index e746e4ba41d..297651c85e9 100644
--- a/llvm/tools/llvm-exegesis/lib/Clustering.h
+++ b/llvm/tools/llvm-exegesis/lib/Clustering.h
@@ -90,7 +90,14 @@ public:
// Returns true if the given point is within a distance Epsilon of each other.
bool isNeighbour(const std::vector<BenchmarkMeasure> &P,
- const std::vector<BenchmarkMeasure> &Q) const;
+ const std::vector<BenchmarkMeasure> &Q) const {
+ double DistanceSquared = 0.0;
+ for (size_t I = 0, E = P.size(); I < E; ++I) {
+ const auto Diff = P[I].PerInstructionValue - Q[I].PerInstructionValue;
+ DistanceSquared += Diff * Diff;
+ }
+ return DistanceSquared <= EpsilonSquared_;
+ }
private:
InstructionBenchmarkClustering(
OpenPOWER on IntegriCloud