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

Unified Diff: dm/DMReporter.cpp

Issue 433403005: Print max memory usage on Linux. (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 | no next file » | 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 3f71d693e43a750b98dc348871d4ee228664098e..5187a6f453ae6ab086793756d58e42436d83558a 100644
--- a/dm/DMReporter.cpp
+++ b/dm/DMReporter.cpp
@@ -4,6 +4,17 @@
#include "SkCommonFlags.h"
#include "OverwriteLine.h"
+#ifdef SK_BUILD_FOR_UNIX
+ #include <sys/resource.h>
+ static long get_max_rss_kb() {
+ struct rusage ru;
+ getrusage(RUSAGE_SELF, &ru);
+ return ru.ru_maxrss;
+ }
+#else
+ static long get_max_rss_kb() { return 0; }
+#endif
+
namespace DM {
void Reporter::printStatus(SkString name, SkMSec timeMs) const {
@@ -21,7 +32,10 @@ void Reporter::printStatus(SkString name, SkMSec timeMs) const {
status.appendf(", %d failed", failed);
}
if (FLAGS_verbose) {
- status.appendf("\t%5dms %s", timeMs, name.c_str());
+ 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());
}
SkDebugf("%s", status.c_str());
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698