diff options
author | 2019-01-09 11:27:40 +0000 | |
---|---|---|
committer | 2019-01-22 10:16:16 +0000 | |
commit | de6c7145b3214f5c8a580b8bb73ea980d046a3a1 (patch) | |
tree | 8d15ba2343471d73c9de21fc99761124b6a053eb | |
parent | e0c33a29811343e634b7445b7c0aac3c9a6a8f73 (diff) |
Adjust thresholds for pretty printing size.
Ensure that the printed number has at least 2 significant digits.
Test: Check ANR report.
Test: test.py -b --host
Change-Id: Icb3d252a2026431072fbab4f3337d50a2f72b342
-rw-r--r-- | libartbase/base/utils.cc | 8 | ||||
-rw-r--r-- | libartbase/base/utils_test.cc | 4 | ||||
-rw-r--r-- | test/202-thread-oome/src/Main.java | 2 |
3 files changed, 7 insertions, 7 deletions
diff --git a/libartbase/base/utils.cc b/libartbase/base/utils.cc index 58d8575ea8..b989d9e495 100644 --- a/libartbase/base/utils.cc +++ b/libartbase/base/utils.cc @@ -96,10 +96,10 @@ std::string PrettySize(int64_t byte_count) { // The byte thresholds at which we display amounts. A byte count is displayed // in unit U when kUnitThresholds[U] <= bytes < kUnitThresholds[U+1]. static const int64_t kUnitThresholds[] = { - 0, // B up to... - 3*1024, // KB up to... - 2*1024*1024, // MB up to... - 1024*1024*1024 // GB from here. + 0, // B up to... + 10*KB, // KB up to... + 10*MB, // MB up to... + 10LL*GB // GB from here. }; static const int64_t kBytesPerUnit[] = { 1, KB, MB, GB }; static const char* const kUnitStrings[] = { "B", "KB", "MB", "GB" }; diff --git a/libartbase/base/utils_test.cc b/libartbase/base/utils_test.cc index c3b61cefde..631a225db4 100644 --- a/libartbase/base/utils_test.cc +++ b/libartbase/base/utils_test.cc @@ -23,8 +23,8 @@ namespace art { class UtilsTest : public testing::Test {}; TEST_F(UtilsTest, PrettySize) { - EXPECT_EQ("1GB", PrettySize(1 * GB)); - EXPECT_EQ("2GB", PrettySize(2 * GB)); + EXPECT_EQ("1024MB", PrettySize(1 * GB)); + EXPECT_EQ("2048MB", PrettySize(2 * GB)); if (sizeof(size_t) > sizeof(uint32_t)) { EXPECT_EQ("100GB", PrettySize(100 * GB)); } diff --git a/test/202-thread-oome/src/Main.java b/test/202-thread-oome/src/Main.java index f7df93be20..b5c0ce6443 100644 --- a/test/202-thread-oome/src/Main.java +++ b/test/202-thread-oome/src/Main.java @@ -21,7 +21,7 @@ public class Main { t.start(); } catch (OutOfMemoryError expected) { // TODO: fix bionic bug https://b/6702535 so we can check the full detail message. - if (!expected.getMessage().startsWith("pthread_create (3GB stack) failed: ")) { + if (!expected.getMessage().startsWith("pthread_create (3073MB stack) failed: ")) { throw new AssertionError(expected); } } |