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

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

Issue 2568313004: [memory-infra] Implement PollFastMemoryTotal in ProcessMetricsMemoryDumpProvider. (Closed)
Patch Set: Created 4 years 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
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 #ifndef COMPONENTS_TRACING_COMMON_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_ 5 #ifndef COMPONENTS_TRACING_COMMON_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_
6 #define COMPONENTS_TRACING_COMMON_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_ 6 #define COMPONENTS_TRACING_COMMON_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 15 matching lines...) Expand all
26 public: 26 public:
27 // Pass base::kNullProcessId to register for current process. 27 // Pass base::kNullProcessId to register for current process.
28 static void RegisterForProcess(base::ProcessId process); 28 static void RegisterForProcess(base::ProcessId process);
29 static void UnregisterForProcess(base::ProcessId process); 29 static void UnregisterForProcess(base::ProcessId process);
30 30
31 ~ProcessMetricsMemoryDumpProvider() override; 31 ~ProcessMetricsMemoryDumpProvider() override;
32 32
33 // MemoryDumpProvider implementation. 33 // MemoryDumpProvider implementation.
34 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, 34 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
35 base::trace_event::ProcessMemoryDump* pmd) override; 35 base::trace_event::ProcessMemoryDump* pmd) override;
36 void PollFastMemoryTotal(uint64_t* memory_total) override;
Primiano Tucci (use gerrit) 2016/12/13 20:02:39 maybe give this argument a more descriptive name,
ssid 2016/12/14 02:59:32 Please note this patch depends on that. And, this
37 void SetFastMemoryPollingEnabled(bool enabled) override;
36 38
37 private: 39 private:
38 FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest, 40 FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest,
39 ParseProcSmaps); 41 ParseProcSmaps);
40 FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest, DumpRSS); 42 FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest, DumpRSS);
43 FRIEND_TEST_ALL_PREFIXES(ProcessMetricsMemoryDumpProviderTest,
44 TestPollFastMemoryTotal);
41 45
42 ProcessMetricsMemoryDumpProvider(base::ProcessId process); 46 ProcessMetricsMemoryDumpProvider(base::ProcessId process);
43 47
44 bool DumpProcessTotals(const base::trace_event::MemoryDumpArgs& args, 48 bool DumpProcessTotals(const base::trace_event::MemoryDumpArgs& args,
45 base::trace_event::ProcessMemoryDump* pmd); 49 base::trace_event::ProcessMemoryDump* pmd);
46 bool DumpProcessMemoryMaps(const base::trace_event::MemoryDumpArgs& args, 50 bool DumpProcessMemoryMaps(const base::trace_event::MemoryDumpArgs& args,
47 base::trace_event::ProcessMemoryDump* pmd); 51 base::trace_event::ProcessMemoryDump* pmd);
48 52
49 static uint64_t rss_bytes_for_testing; 53 static uint64_t rss_bytes_for_testing;
50 54
51 #if defined(OS_LINUX) || defined(OS_ANDROID) 55 #if defined(OS_LINUX) || defined(OS_ANDROID)
56 void ClearProcStatmFile();
Primiano Tucci (use gerrit) 2016/12/13 20:02:39 remove this, not defined anywhere, I guess it's a
ssid 2016/12/14 02:59:32 Sorry fixed.
57
52 static FILE* proc_smaps_for_testing; 58 static FILE* proc_smaps_for_testing;
59
60 int proc_statm_file_;
Primiano Tucci (use gerrit) 2016/12/13 20:02:39 fast_polling_statm_fd_
ssid 2016/12/14 02:59:32 Done.
53 #endif 61 #endif
54 62
55 base::ProcessId process_; 63 base::ProcessId process_;
56 std::unique_ptr<base::ProcessMetrics> process_metrics_; 64 std::unique_ptr<base::ProcessMetrics> process_metrics_;
57 65
58 // The peak may not be resettable on all the processes if the linux kernel is 66 // The peak may not be resettable on all the processes if the linux kernel is
59 // older than http://bit.ly/reset_rss or only on child processes if yama LSM 67 // older than http://bit.ly/reset_rss or only on child processes if yama LSM
60 // sandbox is enabled. 68 // sandbox is enabled.
61 bool is_rss_peak_resettable_; 69 bool is_rss_peak_resettable_;
62 70
63 DISALLOW_COPY_AND_ASSIGN(ProcessMetricsMemoryDumpProvider); 71 DISALLOW_COPY_AND_ASSIGN(ProcessMetricsMemoryDumpProvider);
64 }; 72 };
65 73
66 } // namespace tracing 74 } // namespace tracing
67 75
68 #endif // COMPONENTS_TRACING_COMMON_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_ 76 #endif // COMPONENTS_TRACING_COMMON_PROCESS_MEMORY_METRICS_DUMP_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698