aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/ProcStats.h
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2015-03-12 08:24:21 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-12 08:24:21 -0700
commit95553d917c73ef333ede967521560957a5b6a0ad (patch)
tree4eb0fb4979869525deb73a7fa37f79e54a661461 /tools/ProcStats.h
parent01cbf6c4673b805ab80e2b37e35eb4c89b135a1b (diff)
DM: display current memory usage (instead of peak) when available.
Seems strictly more useful. This implements Mac and Windows, which seemed easy. Don't know how to do this on Linux yet. BUG=skia: CQ_EXTRA_TRYBOTS=client.skia:Test-Mac10.9-MacMini6.2-HD4000-x86_64-Debug-Trybot NOTREECHECKS=true TBR=halcanary@google.com Review URL: https://codereview.chromium.org/990723002
Diffstat (limited to 'tools/ProcStats.h')
-rw-r--r--tools/ProcStats.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/tools/ProcStats.h b/tools/ProcStats.h
index 14b98b7a28..f085fe31a6 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