OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // This file contains routines for gathering resource statistics for processes | 5 // This file contains routines for gathering resource statistics for processes |
6 // running on the system. | 6 // running on the system. |
7 | 7 |
8 #ifndef BASE_PROCESS_PROCESS_METRICS_H_ | 8 #ifndef BASE_PROCESS_PROCESS_METRICS_H_ |
9 #define BASE_PROCESS_PROCESS_METRICS_H_ | 9 #define BASE_PROCESS_PROCESS_METRICS_H_ |
10 | 10 |
11 #include <stddef.h> | 11 #include <stddef.h> |
12 #include <stdint.h> | 12 #include <stdint.h> |
13 | 13 |
14 #include <memory> | 14 #include <memory> |
15 #include <string> | 15 #include <string> |
16 | 16 |
17 #include "base/base_export.h" | 17 #include "base/base_export.h" |
18 #include "base/gtest_prod_util.h" | 18 #include "base/gtest_prod_util.h" |
19 #include "base/macros.h" | 19 #include "base/macros.h" |
20 #include "base/process/process_handle.h" | 20 #include "base/process/process_handle.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "build/build_config.h" | 23 #include "build/build_config.h" |
24 | 24 |
25 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
26 #include <mach/mach.h> | 26 #include <mach/mach.h> |
27 #include "base/process/port_provider_mac.h" | 27 #include "base/process/port_provider_mac.h" |
28 | |
29 #if !defined(OS_IOS) | |
30 #include <mach/mach_vm.h> | |
31 #endif | |
28 #endif | 32 #endif |
29 | 33 |
30 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
31 #include "base/win/scoped_handle.h" | 35 #include "base/win/scoped_handle.h" |
32 #endif | 36 #endif |
33 | 37 |
34 namespace base { | 38 namespace base { |
35 | 39 |
36 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
37 struct IoCounters : public IO_COUNTERS { | 41 struct IoCounters : public IO_COUNTERS { |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
471 size_t committed_memory_; | 475 size_t committed_memory_; |
472 #if defined(OS_LINUX) || defined(OS_ANDROID) | 476 #if defined(OS_LINUX) || defined(OS_ANDROID) |
473 SystemMemoryInfoKB memory_info_; | 477 SystemMemoryInfoKB memory_info_; |
474 SystemDiskInfo disk_info_; | 478 SystemDiskInfo disk_info_; |
475 #endif | 479 #endif |
476 #if defined(OS_CHROMEOS) | 480 #if defined(OS_CHROMEOS) |
477 SwapInfo swap_info_; | 481 SwapInfo swap_info_; |
478 #endif | 482 #endif |
479 }; | 483 }; |
480 | 484 |
485 #if defined(OS_MACOSX) && !defined(OS_IOS) | |
Mark Mentovai
2017/04/21 12:33:51
If you need for these to be available on iOS, you
erikchen
2017/04/21 18:20:59
Nope, don't need for iOS.
| |
486 enum class MachVMRegionResult { | |
487 // There were no more memory regions between |address| and the end of the | |
488 // virtual address space. | |
489 Finished, | |
490 | |
491 // All output parameters are invalid. | |
492 Error, | |
493 | |
494 // All output parameters are filled in. | |
495 Success | |
496 }; | |
497 | |
498 // Returns info on the first memory region at or after |address|, including | |
499 // resident memory and share mode. On Success, |size| reflects the size of the | |
500 // memory region. | |
501 // |size| and |info| are output parameters, only valid on Success. | |
502 // |address| is an in-out parameter, than represents both the address to start | |
503 // looking, and the start address of the memory region. | |
504 BASE_EXPORT MachVMRegionResult GetTopInfo(mach_port_t task, | |
505 mach_vm_size_t* size, | |
506 mach_vm_address_t* address, | |
507 vm_region_top_info_data_t* info); | |
508 | |
509 // Returns info on the first memory region at or after |address|, including | |
510 // protection values. On Success, |size| reflects the size of the | |
511 // memory region. | |
512 // Returns info on the first memory region at or after |address|, including | |
513 // resident memory and share mode. | |
514 // |size| and |info| are output parameters, only valid on Success. | |
515 BASE_EXPORT MachVMRegionResult GetBasicInfo(mach_port_t task, | |
516 mach_vm_size_t* size, | |
517 mach_vm_address_t* address, | |
518 vm_region_basic_info_64* info); | |
519 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | |
520 | |
481 } // namespace base | 521 } // namespace base |
482 | 522 |
483 #endif // BASE_PROCESS_PROCESS_METRICS_H_ | 523 #endif // BASE_PROCESS_PROCESS_METRICS_H_ |
OLD | NEW |