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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 size_t resident_bytes; | 607 size_t resident_bytes; |
608 size_t locked_bytes; | 608 size_t locked_bytes; |
609 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, | 609 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, |
610 &resident_bytes, &locked_bytes)) { | 610 &resident_bytes, &locked_bytes)) { |
611 return false; | 611 return false; |
612 } | 612 } |
613 uint64_t rss_bytes = resident_bytes; | 613 uint64_t rss_bytes = resident_bytes; |
614 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); | 614 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); |
615 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); | 615 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); |
616 pmd->process_totals()->SetExtraFieldInBytes("locked_bytes", locked_bytes); | 616 pmd->process_totals()->SetExtraFieldInBytes("locked_bytes", locked_bytes); |
| 617 |
| 618 base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint& footprint = |
| 619 pmd->process_totals()->GetPlatformPrivateFootprint(); |
| 620 base::ProcessMetrics::TaskVMInfo info = process_metrics_->GetTaskVMInfo(); |
| 621 footprint.phys_footprint_bytes = info.phys_footprint; |
| 622 footprint.internal_bytes = info.internal; |
| 623 footprint.compressed_bytes = info.compressed; |
617 #else | 624 #else |
618 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); | 625 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); |
619 #endif // defined(OS_MACOSX) | 626 #endif // defined(OS_MACOSX) |
620 if (rss_bytes_for_testing) | 627 if (rss_bytes_for_testing) |
621 rss_bytes = rss_bytes_for_testing; | 628 rss_bytes = rss_bytes_for_testing; |
622 | 629 |
623 // rss_bytes will be 0 if the process ended while dumping. | 630 // rss_bytes will be 0 if the process ended while dumping. |
624 if (!rss_bytes) | 631 if (!rss_bytes) |
625 return false; | 632 return false; |
626 | 633 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 #endif | 706 #endif |
700 } | 707 } |
701 | 708 |
702 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { | 709 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { |
703 #if defined(OS_LINUX) || defined(OS_ANDROID) | 710 #if defined(OS_LINUX) || defined(OS_ANDROID) |
704 fast_polling_statm_fd_.reset(); | 711 fast_polling_statm_fd_.reset(); |
705 #endif | 712 #endif |
706 } | 713 } |
707 | 714 |
708 } // namespace tracing | 715 } // namespace tracing |
OLD | NEW |