From 0d154eeaebc640b7bd83e0b212fac22587610a4b Mon Sep 17 00:00:00 2001 From: halcanary Date: Mon, 11 Aug 2014 11:33:51 -0700 Subject: Process Statistics header, add max RSS to render_pdfs Committed: https://skia.googlesource.com/skia/+/6274baae7fe82ce6481da367687aa6168356e1e1 R=mtklein@google.com Author: halcanary@google.com Review URL: https://codereview.chromium.org/448993003 --- tools/ProcStats.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tools/ProcStats.cpp (limited to 'tools/ProcStats.cpp') diff --git a/tools/ProcStats.cpp b/tools/ProcStats.cpp new file mode 100644 index 0000000000..94660394f8 --- /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 + int sk_tools::getMaxResidentSetSizeKB() { + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + #if defined(SK_BUILD_FOR_MAC) + return static_cast(ru.ru_maxrss / 1024); // Darwin reports bytes. + #else + return static_cast(ru.ru_maxrss); // Linux reports kilobytes. + #endif + } + +#else + + int sk_tools::getMaxResidentSetSizeKB() { + return -1; + } + +#endif -- cgit v1.2.3