OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/child/content_child_helpers.h" | 5 #include "content/child/content_child_helpers.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/process/process_metrics.h" |
| 12 #include "build/build_config.h" |
| 13 #include "v8/include/v8.h" |
| 14 |
7 #if defined(OS_LINUX) | 15 #if defined(OS_LINUX) |
8 #include <malloc.h> | 16 #include <malloc.h> |
9 #endif | 17 #endif |
10 | 18 |
11 #include "base/logging.h" | |
12 #include "base/memory/scoped_ptr.h" | |
13 #include "base/process/process_metrics.h" | |
14 #include "v8/include/v8.h" | |
15 | |
16 namespace content { | 19 namespace content { |
17 | 20 |
18 #if defined(OS_LINUX) || defined(OS_ANDROID) | 21 #if defined(OS_LINUX) || defined(OS_ANDROID) |
19 size_t GetMemoryUsageKB() { | 22 size_t GetMemoryUsageKB() { |
20 struct mallinfo minfo = mallinfo(); | 23 struct mallinfo minfo = mallinfo(); |
21 uint64_t mem_usage = | 24 uint64_t mem_usage = |
22 #if defined(USE_TCMALLOC) | 25 #if defined(USE_TCMALLOC) |
23 minfo.uordblks | 26 minfo.uordblks |
24 #else | 27 #else |
25 (minfo.hblkhd + minfo.arena) | 28 (minfo.hblkhd + minfo.arena) |
(...skipping 20 matching lines...) Expand all Loading... |
46 #else | 49 #else |
47 size_t GetMemoryUsageKB() { | 50 size_t GetMemoryUsageKB() { |
48 scoped_ptr<base::ProcessMetrics> process_metrics( | 51 scoped_ptr<base::ProcessMetrics> process_metrics( |
49 base::ProcessMetrics::CreateProcessMetrics( | 52 base::ProcessMetrics::CreateProcessMetrics( |
50 base::GetCurrentProcessHandle())); | 53 base::GetCurrentProcessHandle())); |
51 return process_metrics->GetPagefileUsage() >> 10; | 54 return process_metrics->GetPagefileUsage() >> 10; |
52 } | 55 } |
53 #endif | 56 #endif |
54 | 57 |
55 } // namespace content | 58 } // namespace content |
OLD | NEW |