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

Commit b5e530f7 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "bootstat: Remove debug logging of bootstat_mtime_matches_content."

parents ac0403b1 a51b165c
Loading
Loading
Loading
Loading
+0 −28
Original line number Diff line number Diff line
@@ -46,24 +46,6 @@ bool ParseRecordEventTime(const std::string& path, int32_t* uptime) {

  *uptime = file_stat.st_mtime;

  // The following code (till function exit) is a debug test to ensure the
  // validity of the file mtime value, i.e., to check that the record file
  // mtime values are not changed once set.
  // TODO(jhawkins): Remove this code.
  std::string content;
  if (!android::base::ReadFileToString(path, &content)) {
    PLOG(ERROR) << "Failed to read " << path;
    return false;
  }

  // Ignore existing bootstat records (which do not contain file content).
  if (!content.empty()) {
    int32_t value;
    if (android::base::ParseInt(content, &value)) {
      bootstat::LogHistogram("bootstat_mtime_matches_content", value == *uptime);
    }
  }

  return true;
}

@@ -89,16 +71,6 @@ void BootEventRecordStore::AddBootEventWithValue(
    return;
  }

  // Writing the value as content in the record file is a debug measure to
  // ensure the validity of the file mtime value, i.e., to check that the record
  // file mtime values are not changed once set.
  // TODO(jhawkins): Remove this block.
  if (!android::base::WriteStringToFd(std::to_string(value), record_fd)) {
    PLOG(ERROR) << "Failed to write value to " << record_path;
    close(record_fd);
    return;
  }

  // Fill out the stat structure for |record_path| in order to get the atime to
  // set in the utime() call.
  struct stat file_stat;
+0 −8
Original line number Diff line number Diff line
@@ -45,14 +45,6 @@ bool CreateEmptyBootEventRecord(const std::string& record_path, int32_t value) {
    return false;
  }

  // Writing the value as content in the record file is a debug measure to
  // ensure the validity of the file mtime value, i.e., to check that the record
  // file mtime values are not changed once set.
  // TODO(jhawkins): Remove this block.
  if (!android::base::WriteStringToFd(std::to_string(value), record_fd)) {
    return false;
  }

  // Set the |mtime| of the file to store the value of the boot event while
  // preserving the |atime|.
  struct timeval atime = {/* tv_sec */ 0, /* tv_usec */ 0};