Improve resolved classes saving strategy
If we already have a non empty profile file it means that we already
saved once the resolved classes. So there's no need to hurry up and
start the profile saver eagerly after 2s.
Bug: 27600652
Change-Id: I92ac5869bf68c8d6cbac8fc1503fe3c4930241b4
diff --git a/runtime/utils.cc b/runtime/utils.cc
index 472a85c..6a50b8e 100644
--- a/runtime/utils.cc
+++ b/runtime/utils.cc
@@ -1459,6 +1459,14 @@
return stat(filename.c_str(), &buffer) == 0;
}
+bool FileExistsAndNotEmpty(const std::string& filename) {
+ struct stat buffer;
+ if (stat(filename.c_str(), &buffer) != 0) {
+ return false;
+ }
+ return buffer.st_size > 0;
+}
+
std::string PrettyDescriptor(Primitive::Type type) {
return PrettyDescriptor(Primitive::Descriptor(type));
}