// Remove existing metrics file if it exists. if (OS::FileExists(metrics_file.c_str())) { if (unlink(metrics_file.c_str()) != 0) {
PLOG(ERROR) << "Failed to remove metrics file '" << metrics_file << "'";
}
}
// Create apexdata dalvik-cache directory if it does not exist. It is required before // calling GetFreeSpaceMiB(). if (!EnsureDirectoryExists(cache_directory)) { // This should never fail except for no space on device or configuration issues (e.g. SELinux).
LOG(WARNING) << "Cache directory '" << cache_directory << "' could not be created.";
}
}
OdrMetrics::~OdrMetrics() { // Log metrics only if this is explicitly enabled (typically when compilation was done or an error // occurred). if (enabled_) {
WriteToFile(metrics_file_, this);
}
}
void OdrMetrics::SetDex2OatResult(Stage stage,
int64_t compilation_time_ms, const std::optional<ExecResult>& dex2oat_result) { switch (stage) { case Stage::kPrimaryBootClasspath:
primary_bcp_compilation_millis_ = compilation_time_ms;
primary_bcp_dex2oat_result_ = dex2oat_result; break; case Stage::kSecondaryBootClasspath:
secondary_bcp_compilation_millis_ = compilation_time_ms;
secondary_bcp_dex2oat_result_ = dex2oat_result; break; case Stage::kSystemServerClasspath:
system_server_compilation_millis_ = compilation_time_ms;
system_server_dex2oat_result_ = dex2oat_result; break; case Stage::kCheck: case Stage::kComplete: case Stage::kPreparation: case Stage::kUnknown:
LOG(FATAL) << "Unexpected stage " << stage_ << " when setting dex2oat result";
}
}
void OdrMetrics::SetBcpCompilationType(Stage stage, BcpCompilationType type) { switch (stage) { case Stage::kPrimaryBootClasspath:
primary_bcp_compilation_type_ = type; break; case Stage::kSecondaryBootClasspath:
secondary_bcp_compilation_type_ = type; break; case Stage::kSystemServerClasspath: case Stage::kCheck: case Stage::kComplete: case Stage::kPreparation: case Stage::kUnknown:
LOG(FATAL) << "Unexpected stage " << stage_ << " when setting BCP compilation type";
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.