Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit abae1313 authored by Christopher Ferris's avatar Christopher Ferris Committed by android-build-merger
Browse files

Merge "Make sure at least XX maps are created."

am: 4dac55d5

Change-Id: I047d03fe7be34d9ba1e48568beb25f1eaeefb9d8
parents 20bcca8a 4dac55d5
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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;
  }