Assume the profile file was created before saving.
bug: 26080105
Change-Id: I9969a4abd8533614922076551fcbae2cdf695525
diff --git a/runtime/runtime.cc b/runtime/runtime.cc
index 5c72629..b7fdcdf 100644
--- a/runtime/runtime.cc
+++ b/runtime/runtime.cc
@@ -1685,13 +1685,29 @@
void Runtime::RegisterAppInfo(const std::vector<std::string>& code_paths,
const std::string& profile_output_filename) {
- VLOG(profiler) << "Register app with " << profile_output_filename_
- << " " << Join(code_paths, ':');
- DCHECK(!profile_output_filename.empty());
- profile_output_filename_ = profile_output_filename;
- if (jit_.get() != nullptr && !profile_output_filename.empty() && !code_paths.empty()) {
- jit_->StartProfileSaver(profile_output_filename, code_paths);
+ if (jit_.get() == nullptr) {
+ // We are not JITing. Nothing to do.
+ return;
}
+
+ VLOG(profiler) << "Register app with " << profile_output_filename
+ << " " << Join(code_paths, ':');
+
+ if (profile_output_filename.empty()) {
+ LOG(WARNING) << "JIT profile information will not be recorded: profile filename is empty.";
+ return;
+ }
+ if (!FileExists(profile_output_filename)) {
+ LOG(WARNING) << "JIT profile information will not be recorded: profile file does not exits.";
+ return;
+ }
+ if (code_paths.empty()) {
+ LOG(WARNING) << "JIT profile information will not be recorded: code paths is empty.";
+ return;
+ }
+
+ profile_output_filename_ = profile_output_filename;
+ jit_->StartProfileSaver(profile_output_filename, code_paths);
}
// Transaction support.