OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/tracing/common/process_metrics_memory_dump_provider.h" | 5 #include "components/tracing/common/process_metrics_memory_dump_provider.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 size_t resident_bytes; | 615 size_t resident_bytes; |
616 size_t locked_bytes; | 616 size_t locked_bytes; |
617 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, | 617 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, |
618 &resident_bytes, &locked_bytes)) { | 618 &resident_bytes, &locked_bytes)) { |
619 return false; | 619 return false; |
620 } | 620 } |
621 uint64_t rss_bytes = resident_bytes; | 621 uint64_t rss_bytes = resident_bytes; |
622 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); | 622 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); |
623 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); | 623 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); |
624 pmd->process_totals()->SetExtraFieldInBytes("locked_bytes", locked_bytes); | 624 pmd->process_totals()->SetExtraFieldInBytes("locked_bytes", locked_bytes); |
| 625 |
| 626 if (mac::IsAtLeastOS10_12()) { |
| 627 pmd->process_totals()->set_private_footprint_precursor( |
| 628 process_metrics_->GetPhysicalFootprint()); |
| 629 } else { |
| 630 pmd->process_totals()->set_private_footprint_precursor( |
| 631 process_metrics_->GetInternalAndCompressed()); |
| 632 } |
625 #else | 633 #else |
626 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); | 634 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); |
627 #endif // defined(OS_MACOSX) | 635 #endif // defined(OS_MACOSX) |
628 if (rss_bytes_for_testing) | 636 if (rss_bytes_for_testing) |
629 rss_bytes = rss_bytes_for_testing; | 637 rss_bytes = rss_bytes_for_testing; |
630 | 638 |
631 // rss_bytes will be 0 if the process ended while dumping. | 639 // rss_bytes will be 0 if the process ended while dumping. |
632 if (!rss_bytes) | 640 if (!rss_bytes) |
633 return false; | 641 return false; |
634 | 642 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 #endif | 715 #endif |
708 } | 716 } |
709 | 717 |
710 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { | 718 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { |
711 #if defined(OS_LINUX) || defined(OS_ANDROID) | 719 #if defined(OS_LINUX) || defined(OS_ANDROID) |
712 fast_polling_statm_fd_.reset(); | 720 fast_polling_statm_fd_.reset(); |
713 #endif | 721 #endif |
714 } | 722 } |
715 | 723 |
716 } // namespace tracing | 724 } // namespace tracing |
OLD | NEW |