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

Unified Diff: tools/ProcStats.cpp

Issue 448993003: Process Statistics header, add max RSS to render_pdfs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: compiles on macos and ios 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 | « tools/ProcStats.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ProcStats.cpp
diff --git a/tools/ProcStats.cpp b/tools/ProcStats.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..94660394f8997143edb5e1daf74882291d6c013a
--- /dev/null
+++ b/tools/ProcStats.cpp
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "ProcStats.h"
+
+#if defined(SK_BUILD_FOR_UNIX) || \
+ defined(SK_BUILD_FOR_MAC) || \
+ defined(SK_BUILD_FOR_ANDROID)
+
+ #include <sys/resource.h>
+ int sk_tools::getMaxResidentSetSizeKB() {
+ struct rusage ru;
+ getrusage(RUSAGE_SELF, &ru);
+ #if defined(SK_BUILD_FOR_MAC)
+ return static_cast<int>(ru.ru_maxrss / 1024); // Darwin reports bytes.
+ #else
+ return static_cast<int>(ru.ru_maxrss); // Linux reports kilobytes.
+ #endif
+ }
+
+#else
+
+ int sk_tools::getMaxResidentSetSizeKB() {
+ return -1;
+ }
+
+#endif
« no previous file with comments | « tools/ProcStats.h ('k') | tools/render_pdfs_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698