| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 #include "webrtc/base/memory_usage.h" | 11 #include "webrtc/rtc_base/memory_usage.h" |
| 12 | 12 |
| 13 #if defined(WEBRTC_LINUX) | 13 #if defined(WEBRTC_LINUX) |
| 14 #include <unistd.h> | 14 #include <unistd.h> |
| 15 #include <cstdlib> | 15 #include <cstdlib> |
| 16 #include <cstdio> | 16 #include <cstdio> |
| 17 #include <cstring> | 17 #include <cstring> |
| 18 #elif defined(WEBRTC_MAC) | 18 #elif defined(WEBRTC_MAC) |
| 19 #include <mach/mach.h> | 19 #include <mach/mach.h> |
| 20 #elif defined(WEBRTC_WIN) | 20 #elif defined(WEBRTC_WIN) |
| 21 #include <windows.h> | 21 #include <windows.h> |
| 22 #include <psapi.h> | 22 #include <psapi.h> |
| 23 #endif | 23 #endif |
| 24 | 24 |
| 25 #include "webrtc/base/logging.h" | 25 #include "webrtc/rtc_base/logging.h" |
| 26 | 26 |
| 27 namespace rtc { | 27 namespace rtc { |
| 28 | 28 |
| 29 int64_t GetProcessResidentSizeBytes() { | 29 int64_t GetProcessResidentSizeBytes() { |
| 30 #if defined(WEBRTC_LINUX) | 30 #if defined(WEBRTC_LINUX) |
| 31 FILE* file = fopen("/proc/self/statm", "r"); | 31 FILE* file = fopen("/proc/self/statm", "r"); |
| 32 if (file == nullptr) { | 32 if (file == nullptr) { |
| 33 LOG(LS_ERROR) << "Failed to open /proc/self/statm"; | 33 LOG(LS_ERROR) << "Failed to open /proc/self/statm"; |
| 34 return -1; | 34 return -1; |
| 35 } | 35 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 60 return pmc.WorkingSetSize; | 60 return pmc.WorkingSetSize; |
| 61 #else | 61 #else |
| 62 // Not implemented yet. | 62 // Not implemented yet. |
| 63 static_assert(false, | 63 static_assert(false, |
| 64 "GetProcessVirtualMemoryUsageBytes() platform support not yet " | 64 "GetProcessVirtualMemoryUsageBytes() platform support not yet " |
| 65 "implemented."); | 65 "implemented."); |
| 66 #endif | 66 #endif |
| 67 } | 67 } |
| 68 | 68 |
| 69 } // namespace rtc | 69 } // namespace rtc |
| OLD | NEW |