Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: components/tracing/common/process_metrics_memory_dump_provider.cc

Issue 2839733004: Fill in PlatformPrivateFootprint on Linux (Closed)
Patch Set: update for parent patch changes Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/trace_event/process_memory_totals.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 #endif // defined(OS_MACOSX) 626 #endif // defined(OS_MACOSX)
627 if (rss_bytes_for_testing) 627 if (rss_bytes_for_testing)
628 rss_bytes = rss_bytes_for_testing; 628 rss_bytes = rss_bytes_for_testing;
629 629
630 // rss_bytes will be 0 if the process ended while dumping. 630 // rss_bytes will be 0 if the process ended while dumping.
631 if (!rss_bytes) 631 if (!rss_bytes)
632 return false; 632 return false;
633 633
634 uint64_t peak_rss_bytes = 0; 634 uint64_t peak_rss_bytes = 0;
635 635
636 #if defined(OS_LINUX)
hjd 2017/04/26 14:24:15 I need to try this out on the other two platforms
637 base::trace_event::ProcessMemoryTotals::PlatformPrivateFootprint& footprint =
638 pmd->process_totals()->GetPlatformPrivateFootprint();
639 footprint.rss_anon_bytes = process_metrics_->GetRssAnonBytes();
640 footprint.vm_swap_bytes = process_metrics_->GetVmSwapBytes();
641 #endif // defined(OS_LINUX)
642
636 #if !defined(OS_IOS) 643 #if !defined(OS_IOS)
637 peak_rss_bytes = process_metrics_->GetPeakWorkingSetSize(); 644 peak_rss_bytes = process_metrics_->GetPeakWorkingSetSize();
638 #if defined(OS_LINUX) || defined(OS_ANDROID) 645 #if defined(OS_LINUX) || defined(OS_ANDROID)
639 if (is_rss_peak_resettable_) { 646 if (is_rss_peak_resettable_) {
640 std::string clear_refs_file = 647 std::string clear_refs_file =
641 "/proc/" + 648 "/proc/" +
642 (process_ == base::kNullProcessId ? "self" 649 (process_ == base::kNullProcessId ? "self"
643 : base::IntToString(process_)) + 650 : base::IntToString(process_)) +
644 "/clear_refs"; 651 "/clear_refs";
645 int clear_refs_fd = open(clear_refs_file.c_str(), O_WRONLY); 652 int clear_refs_fd = open(clear_refs_file.c_str(), O_WRONLY);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 #endif 713 #endif
707 } 714 }
708 715
709 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() { 716 void ProcessMetricsMemoryDumpProvider::SuspendFastMemoryPolling() {
710 #if defined(OS_LINUX) || defined(OS_ANDROID) 717 #if defined(OS_LINUX) || defined(OS_ANDROID)
711 fast_polling_statm_fd_.reset(); 718 fast_polling_statm_fd_.reset();
712 #endif 719 #endif
713 } 720 }
714 721
715 } // namespace tracing 722 } // namespace tracing
OLDNEW
« no previous file with comments | « base/trace_event/process_memory_totals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698