• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_TOTALS_DUMP_PROVIDER_H_
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_DUMP_PROVIDER_H_
7 
8 #include <stdint.h>
9 
10 #include "base/gtest_prod_util.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/singleton.h"
14 #include "base/trace_event/memory_dump_provider.h"
15 
16 namespace base {
17 
18 class ProcessMetrics;
19 
20 namespace trace_event {
21 
22 // Dump provider which collects process-wide memory stats.
23 class BASE_EXPORT ProcessMemoryTotalsDumpProvider : public MemoryDumpProvider {
24  public:
25   static ProcessMemoryTotalsDumpProvider* GetInstance();
26 
27   // MemoryDumpProvider implementation.
28   bool OnMemoryDump(const MemoryDumpArgs& args,
29                     ProcessMemoryDump* pmd) override;
30 
31  private:
32   friend struct DefaultSingletonTraits<ProcessMemoryTotalsDumpProvider>;
33   FRIEND_TEST_ALL_PREFIXES(ProcessMemoryTotalsDumpProviderTest, DumpRSS);
34 
35   static uint64_t rss_bytes_for_testing;
36 
37   ProcessMemoryTotalsDumpProvider();
38   ~ProcessMemoryTotalsDumpProvider() override;
39 
40   scoped_ptr<ProcessMetrics> process_metrics_;
41 
42   DISALLOW_COPY_AND_ASSIGN(ProcessMemoryTotalsDumpProvider);
43 };
44 
45 }  // namespace trace_event
46 }  // namespace base
47 
48 #endif  // BASE_TRACE_EVENT_PROCESS_MEMORY_TOTALS_DUMP_PROVIDER_H_
49