diff options
Diffstat (limited to 'runtime/utils.cc')
-rw-r--r-- | runtime/utils.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/runtime/utils.cc b/runtime/utils.cc index eddc3a417a..8e9f12b7a0 100644 --- a/runtime/utils.cc +++ b/runtime/utils.cc @@ -1446,6 +1446,11 @@ bool Exec(std::vector<std::string>& arg_vector, std::string* error_msg) { return true; } +bool FileExists(const std::string& filename) { + struct stat buffer; + return stat(filename.c_str(), &buffer) == 0; +} + std::string PrettyDescriptor(Primitive::Type type) { return PrettyDescriptor(Primitive::Descriptor(type)); } @@ -1860,4 +1865,16 @@ void ParseDouble(const std::string& option, *parsed_value = value; } +int64_t GetFileSizeBytes(const std::string& filename) { + struct stat stat_buf; + int rc = stat(filename.c_str(), &stat_buf); + return rc == 0 ? stat_buf.st_size : -1; +} + +void SleepForever() { + while (true) { + usleep(1000000); + } +} + } // namespace art |