Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Unified Diff: dm/DMReporter.cpp

Issue 448243003: Revert of Process Statistics header, add max RSS to render_pdfs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | gyp/dm.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « no previous file | gyp/dm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698