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

Side by Side Diff: tools/ProcStats.cpp

Issue 661413004: Implement maxrss for Windows (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: speeeeeeelling Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "ProcStats.h" 8 #include "ProcStats.h"
9 9
10 #if defined(SK_BUILD_FOR_UNIX) || \ 10 #if defined(SK_BUILD_FOR_UNIX) || \
11 defined(SK_BUILD_FOR_MAC) || \ 11 defined(SK_BUILD_FOR_MAC) || \
12 defined(SK_BUILD_FOR_ANDROID) 12 defined(SK_BUILD_FOR_ANDROID)
13 13
14 #include <sys/resource.h> 14 #include <sys/resource.h>
15 int sk_tools::getMaxResidentSetSizeMB() { 15 int sk_tools::getMaxResidentSetSizeMB() {
16 struct rusage ru; 16 struct rusage ru;
17 getrusage(RUSAGE_SELF, &ru); 17 getrusage(RUSAGE_SELF, &ru);
18 #if defined(SK_BUILD_FOR_MAC) 18 #if defined(SK_BUILD_FOR_MAC)
19 return static_cast<int>(ru.ru_maxrss / 1024 / 1024); // Darwin reports bytes. 19 return static_cast<int>(ru.ru_maxrss / 1024 / 1024); // Darwin reports bytes.
20 #else 20 #else
21 return static_cast<int>(ru.ru_maxrss / 1024); // Linux reports kilobyte s. 21 return static_cast<int>(ru.ru_maxrss / 1024); // Linux reports kilobyte s.
22 #endif 22 #endif
23 } 23 }
24 24
25 #elif defined(SK_BUILD_FOR_WIN32)
26 #include <windows.h>
27 #include <psapi.h>
28 int sk_tools::getMaxResidentSetSizeMB() {
29 PROCESS_MEMORY_COUNTERS info;
30 GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info));
31 return static_cast<int>(info.PeakWorkingSetSize / 1024 / 1024); // Wind ows reports bytes.
32 }
33
25 #else 34 #else
26
27 int sk_tools::getMaxResidentSetSizeMB() { 35 int sk_tools::getMaxResidentSetSizeMB() {
28 return -1; 36 return -1;
29 } 37 }
30 38
31 #endif 39 #endif
OLDNEW
« 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