summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hackmann <ghackmann@google.com>2015-02-20 11:00:14 -0800
committerGreg Hackmann <ghackmann@google.com>2015-02-20 11:07:38 -0800
commit567bfb3779f238784be6d3fa9d384ecdc423ea39 (patch)
tree690caf6a783541e6877461c908bccddae5f0abdb
parentc39eef71a7f66b69e2216a51d0e7fbc1796d0696 (diff)
downloadbionic-567bfb3779f238784be6d3fa9d384ecdc423ea39.zip
bionic-567bfb3779f238784be6d3fa9d384ecdc423ea39.tar.gz
bionic-567bfb3779f238784be6d3fa9d384ecdc423ea39.tar.bz2
Fix 64-bit benchmark build
The * flag to printf() wants an int instead of size_t, and these are distinct types on 64-bit. To accomodate this, make the name column width helpers return int. In theory this truncates things, but in practice this only matters if you have a benchmark with more than INT_MAX characters in its name (in which case you have bigger problems). Change-Id: I3338948c25a3a8d84f1ead2f5b457c05da8a01cf Signed-off-by: Greg Hackmann <ghackmann@google.com>
-rw-r--r--benchmarks/Benchmark.cpp4
-rw-r--r--benchmarks/benchmark/Benchmark.h14
2 files changed, 9 insertions, 9 deletions
diff --git a/benchmarks/Benchmark.cpp b/benchmarks/Benchmark.cpp
index 0eb779a..eea304f 100644
--- a/benchmarks/Benchmark.cpp
+++ b/benchmarks/Benchmark.cpp
@@ -44,8 +44,8 @@ std::vector<Benchmark*>& Benchmark::List() {
return list;
}
-size_t Benchmark::MaxNameColumnWidth() {
- size_t max = 20;
+int Benchmark::MaxNameColumnWidth() {
+ int max = 20;
for (auto& benchmark : List()) {
max = std::max(max, benchmark->NameColumnWidth());
}
diff --git a/benchmarks/benchmark/Benchmark.h b/benchmarks/benchmark/Benchmark.h
index 7c208e6..16ae5fa 100644
--- a/benchmarks/benchmark/Benchmark.h
+++ b/benchmarks/benchmark/Benchmark.h
@@ -47,10 +47,10 @@ public:
static std::vector<Benchmark*>& List();
- static size_t MaxNameColumnWidth();
+ static int MaxNameColumnWidth();
protected:
- virtual size_t NameColumnWidth() = 0;
+ virtual int NameColumnWidth() = 0;
uint64_t bytes_processed_;
uint64_t total_time_ns_;
@@ -85,8 +85,8 @@ protected:
virtual void Run(int) = 0;
- virtual size_t NameColumnWidth() override {
- return Name().size();
+ virtual int NameColumnWidth() override {
+ return (int)Name().size();
}
virtual std::string GetNameStr(void *) override;
@@ -104,10 +104,10 @@ public:
}
protected:
- virtual size_t NameColumnWidth() override {
- size_t max = 0;
+ virtual int NameColumnWidth() override {
+ int max = 0;
for (const auto arg : args_) {
- max = std::max(max, GetNameStr(arg).size());
+ max = std::max(max, (int)GetNameStr(arg).size());
}
return max;
}