Index: dm/DMReporter.cpp |
diff --git a/dm/DMReporter.cpp b/dm/DMReporter.cpp |
index 14f50871021ea42e811e547fc452b48089c2f300..12bcfac0f3f7f233b5a7ebc780f75813ece9f536 100644 |
--- a/dm/DMReporter.cpp |
+++ b/dm/DMReporter.cpp |
@@ -3,21 +3,7 @@ |
#include "SkDynamicAnnotations.h" |
#include "SkCommonFlags.h" |
#include "OverwriteLine.h" |
- |
-#if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_ANDROID) |
- #include <sys/resource.h> |
- static long get_max_rss_kb() { |
- struct rusage ru; |
- getrusage(RUSAGE_SELF, &ru); |
- #if defined(SK_BUILD_FOR_MAC) |
- return ru.ru_maxrss / 1024; // Darwin reports bytes. |
- #else |
- return ru.ru_maxrss; // Linux reports kilobytes. |
- #endif |
- } |
-#else |
- static long get_max_rss_kb() { return 0; } |
-#endif |
+#include "ProcStats.h" |
namespace DM { |
@@ -36,8 +22,9 @@ void Reporter::printStatus(SkString name, SkMSec timeMs) const { |
status.appendf(", %d failed", failed); |
} |
if (FLAGS_verbose) { |
- if (long max_rss_kb = get_max_rss_kb()) { |
- status.appendf("\t%4ldM peak", max_rss_kb / 1024); |
+ int max_rss_kb = sk_tools::getMaxResidentSetSizeKB(); |
+ if (max_rss_kb >= 0) { |
+ status.appendf("\t%4dM peak", max_rss_kb / 1024); |
} |
status.appendf("\t%5dms\t%s", timeMs, name.c_str()); |
} |