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

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

Issue 1618703004: [MemoryInfra] Support dump providers running on SequencedTaskRunner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes. Created 4 years, 10 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/memory_dump_provider.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/process_metrics_memory_dump_provider.h" 5 #include "components/tracing/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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 pmd->set_has_process_mmaps(); 196 pmd->set_has_process_mmaps();
197 return res; 197 return res;
198 } 198 }
199 #endif // defined(OS_LINUX) || defined(OS_ANDROID) 199 #endif // defined(OS_LINUX) || defined(OS_ANDROID)
200 200
201 // static 201 // static
202 void ProcessMetricsMemoryDumpProvider::RegisterForProcess( 202 void ProcessMetricsMemoryDumpProvider::RegisterForProcess(
203 base::ProcessId process) { 203 base::ProcessId process) {
204 scoped_ptr<ProcessMetricsMemoryDumpProvider> metrics_provider( 204 scoped_ptr<ProcessMetricsMemoryDumpProvider> metrics_provider(
205 new ProcessMetricsMemoryDumpProvider(process)); 205 new ProcessMetricsMemoryDumpProvider(process));
206 base::trace_event::MemoryDumpProvider::Options options(process); 206 base::trace_event::MemoryDumpProvider::Options options;
207 options.target_pid = process;
207 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider( 208 base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
208 metrics_provider.get(), "ProcessMemoryMetrics", nullptr, options); 209 metrics_provider.get(), "ProcessMemoryMetrics", nullptr, options);
209 bool did_insert = 210 bool did_insert =
210 g_dump_providers_map.Get() 211 g_dump_providers_map.Get()
211 .insert(std::make_pair(process, std::move(metrics_provider))) 212 .insert(std::make_pair(process, std::move(metrics_provider)))
212 .second; 213 .second;
213 if (!did_insert) { 214 if (!did_insert) {
214 DLOG(ERROR) << "ProcessMetricsMemoryDumpProvider already registered for " 215 DLOG(ERROR) << "ProcessMetricsMemoryDumpProvider already registered for "
215 << (process == base::kNullProcessId 216 << (process == base::kNullProcessId
216 ? "current process" 217 ? "current process"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 297
297 pmd->process_totals()->set_resident_set_bytes(rss_bytes); 298 pmd->process_totals()->set_resident_set_bytes(rss_bytes);
298 pmd->set_has_process_totals(); 299 pmd->set_has_process_totals();
299 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes); 300 pmd->process_totals()->set_peak_resident_set_bytes(peak_rss_bytes);
300 301
301 // Returns true even if other metrics failed, since rss is reported. 302 // Returns true even if other metrics failed, since rss is reported.
302 return true; 303 return true;
303 } 304 }
304 305
305 } // namespace tracing 306 } // namespace tracing
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_provider.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698