| Index: dm/DMReporter.cpp
|
| diff --git a/dm/DMReporter.cpp b/dm/DMReporter.cpp
|
| index 12bcfac0f3f7f233b5a7ebc780f75813ece9f536..14f50871021ea42e811e547fc452b48089c2f300 100644
|
| --- a/dm/DMReporter.cpp
|
| +++ b/dm/DMReporter.cpp
|
| @@ -3,7 +3,21 @@
|
| #include "SkDynamicAnnotations.h"
|
| #include "SkCommonFlags.h"
|
| #include "OverwriteLine.h"
|
| -#include "ProcStats.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
|
|
|
| namespace DM {
|
|
|
| @@ -22,9 +36,8 @@
|
| status.appendf(", %d failed", failed);
|
| }
|
| if (FLAGS_verbose) {
|
| - int max_rss_kb = sk_tools::getMaxResidentSetSizeKB();
|
| - if (max_rss_kb >= 0) {
|
| - status.appendf("\t%4dM peak", max_rss_kb / 1024);
|
| + if (long max_rss_kb = get_max_rss_kb()) {
|
| + status.appendf("\t%4ldM peak", max_rss_kb / 1024);
|
| }
|
| status.appendf("\t%5dms\t%s", timeMs, name.c_str());
|
| }
|
|
|