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

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

Issue 1417003003: [tracing] Dump child processes' memory metrics in browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: Remove manager Created 5 years, 1 month 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_
7
8 #include "base/gtest_prod_util.h"
9 #include "base/macros.h"
10 #include "base/process/process_handle.h"
11 #include "base/trace_event/memory_dump_provider.h"
12 #include "build/build_config.h"
13 #include "components/tracing/tracing_export.h"
14
15 namespace base {
16 class ProcessMetrics;
17 }
18
19 namespace tracing {
20
21 // Dump provider which collects process-wide memory stats.
22 class TRACING_EXPORT ProcessMetricsMemoryDumpProvider
23 : public base::trace_event::MemoryDumpProvider {
24 public:
25 // Pass base::kNullProcessHandle to register for current process.
26 static void RegisterForProcess(base::ProcessHandle process);
Primiano Tucci (use gerrit) 2015/12/14 10:52:21 What is the rationale for passing ProcessHandle w.
ssid 2016/01/04 20:54:38 Hm the CreateProcessMetrics takes ProcessHandle an
27 static void UnregisterForProcess(base::ProcessHandle process);
28
29 ~ProcessMetricsMemoryDumpProvider() override;
30
31 // MemoryDumpProvider implementation.
32 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
33 base::trace_event::ProcessMemoryDump* pmd) override;
34
35 private:
36 FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest,
37 ParseProcSmaps);
38 FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest, DumpRSS);
39
40 ProcessMetricsMemoryDumpProvider(base::ProcessHandle process);
41
42 void DumpProcessTotals(const base::trace_event::MemoryDumpArgs& args,
43 base::trace_event::ProcessMemoryDump* pmd);
44 void DumpProcessMemoryMaps(const base::trace_event::MemoryDumpArgs& args,
45 base::trace_event::ProcessMemoryDump* pmd);
46
47 static uint64 rss_bytes_for_testing;
48
49 #if defined(OS_LINUX) || defined(OS_ANDROID)
50 static FILE* proc_smaps_for_testing;
51 #endif
52
53 base::ProcessHandle process_;
54 scoped_ptr<base::ProcessMetrics> process_metrics_;
55
56 DISALLOW_COPY_AND_ASSIGN(ProcessMetricsMemoryDumpProvider);
57 };
58
59 } // namespace tracing
60
61 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_MAPS_DUMP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698