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

Side by Side Diff: base/trace_event/memory_dump_session_state.h

Issue 2582453002: [tracing] Implement polling in MemoryDumpManager (Closed)
Patch Set: doc link and fix test. Created 3 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
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 BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set>
9 10
10 #include "base/base_export.h" 11 #include "base/base_export.h"
11 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" 12 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h"
12 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" 13 #include "base/trace_event/heap_profiler_type_name_deduplicator.h"
13 #include "base/trace_event/trace_config.h" 14 #include "base/trace_event/memory_dump_request_args.h"
14 15
15 namespace base { 16 namespace base {
16 namespace trace_event { 17 namespace trace_event {
17 18
18 // Container for state variables that should be shared across all the memory 19 // Container for state variables that should be shared across all the memory
19 // dumps in a tracing session. 20 // dumps in a tracing session.
20 class BASE_EXPORT MemoryDumpSessionState 21 class BASE_EXPORT MemoryDumpSessionState
21 : public RefCountedThreadSafe<MemoryDumpSessionState> { 22 : public RefCountedThreadSafe<MemoryDumpSessionState> {
22 public: 23 public:
23 MemoryDumpSessionState(); 24 MemoryDumpSessionState();
24 25
25 // Returns the stack frame deduplicator that should be used by memory dump 26 // Returns the stack frame deduplicator that should be used by memory dump
26 // providers when doing a heap dump. 27 // providers when doing a heap dump.
27 StackFrameDeduplicator* stack_frame_deduplicator() const { 28 StackFrameDeduplicator* stack_frame_deduplicator() const {
28 return stack_frame_deduplicator_.get(); 29 return stack_frame_deduplicator_.get();
29 } 30 }
30 31
31 void SetStackFrameDeduplicator( 32 void SetStackFrameDeduplicator(
32 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator); 33 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator);
33 34
34 // Returns the type name deduplicator that should be used by memory dump 35 // Returns the type name deduplicator that should be used by memory dump
35 // providers when doing a heap dump. 36 // providers when doing a heap dump.
36 TypeNameDeduplicator* type_name_deduplicator() const { 37 TypeNameDeduplicator* type_name_deduplicator() const {
37 return type_name_deduplicator_.get(); 38 return type_name_deduplicator_.get();
38 } 39 }
39 40
40 void SetTypeNameDeduplicator( 41 void SetTypeNameDeduplicator(
41 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator); 42 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator);
42 43
43 const TraceConfig::MemoryDumpConfig& memory_dump_config() const { 44 void SetAllowedDumpModes(
44 return memory_dump_config_; 45 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes);
46
47 bool IsDumpModeAllowed(MemoryDumpLevelOfDetail dump_mode) const;
48
49 void set_heap_profiler_breakdown_threshold_bytes(uint32_t value) {
50 heap_profiler_breakdown_threshold_bytes_ = value;
45 } 51 }
46 52
47 void SetMemoryDumpConfig(const TraceConfig::MemoryDumpConfig& config); 53 uint32_t heap_profiler_breakdown_threshold_bytes() const {
48 54 return heap_profiler_breakdown_threshold_bytes_;
49 bool is_polling_enabled() { return is_polling_enabled_; } 55 }
50 56
51 private: 57 private:
52 friend class RefCountedThreadSafe<MemoryDumpSessionState>; 58 friend class RefCountedThreadSafe<MemoryDumpSessionState>;
53 ~MemoryDumpSessionState(); 59 ~MemoryDumpSessionState();
54 60
55 // Deduplicates backtraces in heap dumps so they can be written once when the 61 // Deduplicates backtraces in heap dumps so they can be written once when the
56 // trace is finalized. 62 // trace is finalized.
57 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator_; 63 std::unique_ptr<StackFrameDeduplicator> stack_frame_deduplicator_;
58 64
59 // Deduplicates type names in heap dumps so they can be written once when the 65 // Deduplicates type names in heap dumps so they can be written once when the
60 // trace is finalized. 66 // trace is finalized.
61 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator_; 67 std::unique_ptr<TypeNameDeduplicator> type_name_deduplicator_;
62 68
63 // The memory dump config, copied at the time when the tracing session was 69 std::set<MemoryDumpLevelOfDetail> allowed_dump_modes_;
64 // started.
65 TraceConfig::MemoryDumpConfig memory_dump_config_;
66 70
67 // True if memory polling is enabled by the config in the tracing session. 71 uint32_t heap_profiler_breakdown_threshold_bytes_;
68 bool is_polling_enabled_;
69 }; 72 };
70 73
71 } // namespace trace_event 74 } // namespace trace_event
72 } // namespace base 75 } // namespace base
73 76
74 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_ 77 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_SESSION_STATE_H_
OLDNEW
« no previous file with comments | « base/trace_event/memory_dump_scheduler.cc ('k') | base/trace_event/memory_dump_session_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698