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
(cherry picked from commit c15e566b36170237f01ccefc12129c1578a02140)
Change-Id: Iecc730c25eab779efccbbde66432dbbc61192e8a
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));
}