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

Unified Diff: tools/ProcStats.h

Issue 990723002: DM: display current memory usage (instead of peak) when available. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: better best Created 5 years, 9 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 | « dm/DM.cpp ('k') | tools/ProcStats.cpp » ('j') | tools/ProcStats.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/ProcStats.h
diff --git a/tools/ProcStats.h b/tools/ProcStats.h
index 14b98b7a28c2c187df1d316bf7b628e0286ebdd4..f085fe31a6ff532044928b32a04e567a1be6a5a8 100644
--- a/tools/ProcStats.h
+++ b/tools/ProcStats.h
@@ -15,11 +15,27 @@
namespace sk_tools {
/**
- * If not implemented for this OS, returns -1. Otherwise, return
- * the maximum resident set size, as reported by getrusage().
+ * If implemented, returns the maximum resident set size in MB.
+ * If not, returns -1.
*/
int getMaxResidentSetSizeMB();
+/**
+ * If implemented, returns the current resident set size in MB.
+ * If not, returns -1.
+ */
+int getCurrResidentSetSizeMB();
+
+/**
+ * If implemented, returns getCurrResidentSetSizeMB().
+ * If not, if implemented, returns getMaxResidentSetSizeMB().
+ * If not, returns -1.
+ */
+inline int getBestResidentSetSizeMB() {
+ int mb = getCurrResidentSetSizeMB();
+ return mb >= 0 ? mb : getMaxResidentSetSizeMB();
+}
+
} // namespace sk_tools
#endif // ProcStats_DEFINED
« no previous file with comments | « dm/DM.cpp ('k') | tools/ProcStats.cpp » ('j') | tools/ProcStats.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698