summaryrefslogtreecommitdiffstats
path: root/libbacktrace
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2017-12-08 12:19:44 -0800
committerChristopher Ferris <cferris@google.com>2017-12-08 12:48:46 -0800
commit88b48f7b18a259a894e2d6644af316cb3046e2b8 (patch)
treec2ebaaca894d72832da0f56088ddfde52c699676 /libbacktrace
parenta4a9a81d383b4c29841279b342a4e8772542ea88 (diff)
downloadsystem_core-88b48f7b18a259a894e2d6644af316cb3046e2b8.tar.gz
system_core-88b48f7b18a259a894e2d6644af316cb3046e2b8.tar.bz2
system_core-88b48f7b18a259a894e2d6644af316cb3046e2b8.zip
Make sure at least XX maps are created.
Rather than expect exactly one set of maps, make sure there are at least XX number of maps. Test: Ran the 32 bit and 64 bit variants of the benchmarks. Change-Id: I34184eab3810e92e7f246aa810ddb18fab443c9a
Diffstat (limited to 'libbacktrace')
-rw-r--r--libbacktrace/backtrace_benchmarks.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/libbacktrace/backtrace_benchmarks.cpp b/libbacktrace/backtrace_benchmarks.cpp
index bb4134fec..a23e3b44c 100644
--- a/libbacktrace/backtrace_benchmarks.cpp
+++ b/libbacktrace/backtrace_benchmarks.cpp
@@ -103,8 +103,9 @@ static void CreateMap(benchmark::State& state, BacktraceMap* (*map_func)(pid_t,
exit(1);
}
- if (num_maps != kNumMaps) {
- fprintf(stderr, "Maps set incorrectly: %zu found, %zu expected.\n", num_maps, kNumMaps);
+ if (num_maps < kNumMaps) {
+ fprintf(stderr, "Maps set incorrectly: %zu found, %zu expected at least.\n", num_maps,
+ kNumMaps);
std::string str;
android::base::ReadFileToString("/proc/self/maps", &str);
fprintf(stderr, "%s\n", str.c_str());
@@ -121,12 +122,12 @@ static void CreateMap(benchmark::State& state, BacktraceMap* (*map_func)(pid_t,
size_t num_maps = 0;
for (size_t i = 0; i < 2000; i++) {
- if (CountMaps(pid, &num_maps) && num_maps == kNumMaps) {
+ if (CountMaps(pid, &num_maps) && num_maps >= kNumMaps) {
break;
}
usleep(1000);
}
- if (num_maps != kNumMaps) {
+ if (num_maps < kNumMaps) {
fprintf(stderr, "Timed out waiting for the number of maps available: %zu\n", num_maps);
return;
}