OLD | NEW |
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 BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 5 #ifndef BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 6 #define BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
7 | 7 |
8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/trace_event/process_memory_totals.h" |
10 #include "base/trace_event/trace_event_impl.h" | |
11 | 10 |
12 namespace base { | 11 namespace base { |
13 namespace trace_event { | 12 namespace trace_event { |
14 | 13 |
15 // A container which holds the dumps produced by the MemoryDumpProvider(s) | 14 class ConvertableToTraceFormat; |
16 // for a specific process. ProcessMemoryDump is as a strongly typed container | 15 |
17 // which enforces the data model for each memory dump point. | 16 // ProcessMemoryDump is as a strongly typed container which enforces the data |
18 // At trace generation time (i.e. when AppendAsTraceFormat is called) the | 17 // model for each memory dump point and holds the dumps produced by the |
19 // ProcessMemoryDump will compose a key-value dictionary of the various dumps | 18 // MemoryDumpProvider(s) for a specific process. |
20 // obtained during at trace dump point time. | 19 // At trace generation time (i.e. when AsValue() is called), ProcessMemoryDump |
21 class BASE_EXPORT ProcessMemoryDump : public ConvertableToTraceFormat { | 20 // will compose a key-value dictionary of the various dumps obtained at trace |
| 21 // dump point time. |
| 22 class BASE_EXPORT ProcessMemoryDump { |
22 public: | 23 public: |
23 ProcessMemoryDump(); | 24 ProcessMemoryDump(); |
| 25 ~ProcessMemoryDump(); |
24 | 26 |
25 // ConvertableToTraceFormat implementation. | 27 // Called at trace generation time to populate the TracedValue. |
26 void AppendAsTraceFormat(std::string* out) const override; | 28 void AsValueInto(TracedValue* value) const; |
| 29 |
| 30 ProcessMemoryTotals* process_totals() { return &process_totals_; } |
| 31 bool has_process_totals() const { return has_process_totals_; } |
| 32 void set_has_process_totals() { has_process_totals_ = true; } |
27 | 33 |
28 private: | 34 private: |
29 ~ProcessMemoryDump() override; | 35 ProcessMemoryTotals process_totals_; |
| 36 bool has_process_totals_; |
30 | 37 |
31 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); | 38 DISALLOW_COPY_AND_ASSIGN(ProcessMemoryDump); |
32 }; | 39 }; |
33 | 40 |
34 } // namespace trace_event | 41 } // namespace trace_event |
35 } // namespace base | 42 } // namespace base |
36 | 43 |
37 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ | 44 #endif // BASE_TRACE_EVENT_PROCESS_MEMORY_DUMP_H_ |
OLD | NEW |