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

Side by Side Diff: tools/ProcStats.cpp

Issue 1054073003: Minimal Changes to run tests on iOS (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 5 years, 8 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 | « tests/StreamTest.cpp ('k') | 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) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_ FOR_ANDROID) 10 #if defined(SK_BUILD_FOR_UNIX) || defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_ FOR_IOS) || defined(SK_BUILD_FOR_ANDROID)
11 #include <sys/resource.h> 11 #include <sys/resource.h>
12 int sk_tools::getMaxResidentSetSizeMB() { 12 int sk_tools::getMaxResidentSetSizeMB() {
13 struct rusage ru; 13 struct rusage ru;
14 getrusage(RUSAGE_SELF, &ru); 14 getrusage(RUSAGE_SELF, &ru);
15 #if defined(SK_BUILD_FOR_MAC) 15 #if defined(SK_BUILD_FOR_MAC)
16 return static_cast<int>(ru.ru_maxrss / 1024 / 1024); // Darwin reports bytes. 16 return static_cast<int>(ru.ru_maxrss / 1024 / 1024); // Darwin reports bytes.
17 #else 17 #else
18 return static_cast<int>(ru.ru_maxrss / 1024); // Linux reports kilobyte s. 18 return static_cast<int>(ru.ru_maxrss / 1024); // Linux reports kilobyte s.
19 #endif 19 #endif
20 } 20 }
21 #elif defined(SK_BUILD_FOR_WIN32) 21 #elif defined(SK_BUILD_FOR_WIN32)
22 #include <windows.h> 22 #include <windows.h>
23 #include <psapi.h> 23 #include <psapi.h>
24 int sk_tools::getMaxResidentSetSizeMB() { 24 int sk_tools::getMaxResidentSetSizeMB() {
25 PROCESS_MEMORY_COUNTERS info; 25 PROCESS_MEMORY_COUNTERS info;
26 GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info)); 26 GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info));
27 return static_cast<int>(info.PeakWorkingSetSize / 1024 / 1024); // Wind ows reports bytes. 27 return static_cast<int>(info.PeakWorkingSetSize / 1024 / 1024); // Wind ows reports bytes.
28 } 28 }
29 #else 29 #else
30 int sk_tools::getMaxResidentSetSizeMB() { return -1; } 30 int sk_tools::getMaxResidentSetSizeMB() { return -1; }
31 #endif 31 #endif
32 32
33 #if defined(SK_BUILD_FOR_MAC) 33 #if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
34 #include <mach/mach.h> 34 #include <mach/mach.h>
35 int sk_tools::getCurrResidentSetSizeMB() { 35 int sk_tools::getCurrResidentSetSizeMB() {
36 mach_task_basic_info info; 36 mach_task_basic_info info;
37 mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT; 37 mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT;
38 if (KERN_SUCCESS != 38 if (KERN_SUCCESS !=
39 task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)& info, &count)) { 39 task_info(mach_task_self(), MACH_TASK_BASIC_INFO, (task_info_t)& info, &count)) {
40 return -1; 40 return -1;
41 } 41 }
42 return info.resident_size / 1024 / 1024; // Darwin reports bytes. 42 return info.resident_size / 1024 / 1024; // Darwin reports bytes.
43 } 43 }
(...skipping 16 matching lines...) Expand all
60 60
61 #elif defined(SK_BUILD_FOR_WIN32) 61 #elif defined(SK_BUILD_FOR_WIN32)
62 int sk_tools::getCurrResidentSetSizeMB() { 62 int sk_tools::getCurrResidentSetSizeMB() {
63 PROCESS_MEMORY_COUNTERS info; 63 PROCESS_MEMORY_COUNTERS info;
64 GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info)); 64 GetProcessMemoryInfo(GetCurrentProcess(), &info, sizeof(info));
65 return static_cast<int>(info.WorkingSetSize / 1024 / 1024); // Windows reports bytes. 65 return static_cast<int>(info.WorkingSetSize / 1024 / 1024); // Windows reports bytes.
66 } 66 }
67 #else 67 #else
68 int sk_tools::getCurrResidentSetSizeMB() { return -1; } 68 int sk_tools::getCurrResidentSetSizeMB() { return -1; }
69 #endif 69 #endif
OLDNEW
« no previous file with comments | « tests/StreamTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698