diff options
author | Andreas Gampe <agampe@google.com> | 2015-04-28 23:16:03 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-04-28 23:31:17 -0700 |
commit | 19ad58245b5fac4bdf02045ac47472935b0717cd (patch) | |
tree | a292bd7c7d0a02fe30e207f68e6cf8c67a3e1b6b /dex2oat | |
parent | b349274af4e568d8f6932d92fcc1768eaaa99c56 (diff) | |
download | art-19ad58245b5fac4bdf02045ac47472935b0717cd.zip art-19ad58245b5fac4bdf02045ac47472935b0717cd.tar.gz art-19ad58245b5fac4bdf02045ac47472935b0717cd.tar.bz2 |
ART: Move dex2oat watchdog output to LogLine
The fprintf isn't visible on device, as it doesn't end up in the
logcat.
Also increase the watchdog timeout to 10 minutes.
Bug: 20658562
(cherry picked from commit d687e375cf7507b5c36df63cf03c991038b1c218)
Change-Id: I1fec8dae25f9282f72e762bda934fceb948bbd5f
Diffstat (limited to 'dex2oat')
-rw-r--r-- | dex2oat/dex2oat.cc | 31 |
1 files changed, 12 insertions, 19 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index b764095..8490afb 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <inttypes.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> @@ -324,26 +325,19 @@ class WatchDog { return nullptr; } - static void Message(char severity, const std::string& message) { - // TODO: Remove when we switch to LOG when we can guarantee it won't prevent shutdown in error - // cases. - fprintf(stderr, "dex2oat%s %c %d %d %s\n", - kIsDebugBuild ? "d" : "", - severity, - getpid(), - GetTid(), - message.c_str()); - } - NO_RETURN static void Fatal(const std::string& message) { - Message('F', message); + // TODO: When we can guarantee it won't prevent shutdown in error cases, move to LOG. However, + // it's rather easy to hang in unwinding. + // LogLine also avoids ART logging lock issues, as it's really only a wrapper around + // logcat logging or stderr output. + LogMessage::LogLine(__FILE__, __LINE__, LogSeverity::FATAL, message.c_str()); exit(1); } void Wait() { // TODO: tune the multiplier for GC verification, the following is just to make the timeout // large. - int64_t multiplier = kVerifyObjectSupport > kVerifyObjectModeFast ? 100 : 1; + constexpr int64_t multiplier = kVerifyObjectSupport > kVerifyObjectModeFast ? 100 : 1; timespec timeout_ts; InitTimeSpec(true, CLOCK_REALTIME, multiplier * kWatchDogTimeoutSeconds * 1000, 0, &timeout_ts); const char* reason = "dex2oat watch dog thread waiting"; @@ -351,7 +345,8 @@ class WatchDog { while (!shutting_down_) { int rc = TEMP_FAILURE_RETRY(pthread_cond_timedwait(&cond_, &mutex_, &timeout_ts)); if (rc == ETIMEDOUT) { - Fatal(StringPrintf("dex2oat did not finish after %d seconds", kWatchDogTimeoutSeconds)); + Fatal(StringPrintf("dex2oat did not finish after %" PRId64 " seconds", + kWatchDogTimeoutSeconds)); } else if (rc != 0) { std::string message(StringPrintf("pthread_cond_timedwait failed: %s", strerror(errno))); @@ -363,10 +358,10 @@ class WatchDog { // When setting timeouts, keep in mind that the build server may not be as fast as your desktop. // Debug builds are slower so they have larger timeouts. - static const unsigned int kSlowdownFactor = kIsDebugBuild ? 5U : 1U; + static constexpr int64_t kSlowdownFactor = kIsDebugBuild ? 5U : 1U; - // 6 minutes scaled by kSlowdownFactor. - static const unsigned int kWatchDogTimeoutSeconds = kSlowdownFactor * 6 * 60; + // 10 minutes scaled by kSlowdownFactor. + static constexpr int64_t kWatchDogTimeoutSeconds = kSlowdownFactor * 10 * 60; bool is_watch_dog_enabled_; bool shutting_down_; @@ -1806,8 +1801,6 @@ class Dex2Oat FINAL { DISALLOW_IMPLICIT_CONSTRUCTORS(Dex2Oat); }; -const unsigned int WatchDog::kWatchDogTimeoutSeconds; - static void b13564922() { #if defined(__linux__) && defined(__arm__) int major, minor; |