| 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 594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 return res; | 605 return res; |
| 606 } | 606 } |
| 607 | 607 |
| 608 bool ProcessMetricsMemoryDumpProvider::DumpProcessTotals( | 608 bool ProcessMetricsMemoryDumpProvider::DumpProcessTotals( |
| 609 const base::trace_event::MemoryDumpArgs& args, | 609 const base::trace_event::MemoryDumpArgs& args, |
| 610 base::trace_event::ProcessMemoryDump* pmd) { | 610 base::trace_event::ProcessMemoryDump* pmd) { |
| 611 #if defined(OS_MACOSX) | 611 #if defined(OS_MACOSX) |
| 612 size_t private_bytes; | 612 size_t private_bytes; |
| 613 size_t shared_bytes; | 613 size_t shared_bytes; |
| 614 size_t resident_bytes; | 614 size_t resident_bytes; |
| 615 size_t locked_bytes; | |
| 616 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, | 615 if (!process_metrics_->GetMemoryBytes(&private_bytes, &shared_bytes, |
| 617 &resident_bytes, &locked_bytes)) { | 616 &resident_bytes)) { |
| 618 return false; | 617 return false; |
| 619 } | 618 } |
| 620 uint64_t rss_bytes = resident_bytes; | 619 uint64_t rss_bytes = resident_bytes; |
| 621 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); | 620 pmd->process_totals()->SetExtraFieldInBytes("private_bytes", private_bytes); |
| 622 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); | 621 pmd->process_totals()->SetExtraFieldInBytes("shared_bytes", shared_bytes); |
| 623 pmd->process_totals()->SetExtraFieldInBytes("locked_bytes", locked_bytes); | |
| 624 #else | 622 #else |
| 625 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); | 623 uint64_t rss_bytes = process_metrics_->GetWorkingSetSize(); |
| 626 #endif // defined(OS_MACOSX) | 624 #endif // defined(OS_MACOSX) |
| 627 if (rss_bytes_for_testing) | 625 if (rss_bytes_for_testing) |
| 628 rss_bytes = rss_bytes_for_testing; | 626 rss_bytes = rss_bytes_for_testing; |
| 629 | 627 |
| 630 // rss_bytes will be 0 if the process ended while dumping. | 628 // rss_bytes will be 0 if the process ended while dumping. |
| 631 if (!rss_bytes) | 629 if (!rss_bytes) |
| 632 return false; | 630 return false; |
| 633 | 631 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 #endif | 704 #endif |
| 707 } | 705 } |
| 708 | 706 |
| 709 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { | 707 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { |
| 710 #if defined(OS_LINUX) || defined(OS_ANDROID) | 708 #if defined(OS_LINUX) || defined(OS_ANDROID) |
| 711 fast_polling_statm_fd_.reset(); | 709 fast_polling_statm_fd_.reset(); |
| 712 #endif | 710 #endif |
| 713 } | 711 } |
| 714 | 712 |
| 715 } // namespace tracing | 713 } // namespace tracing |
| OLD | NEW |