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

Unified Diff: base/trace_event/heap_profiler_stack_frame_deduplicator.h

Issue 2650863003: [tracing] Switch to new heap dump format. (Closed)
Patch Set: Add 'version' field. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: base/trace_event/heap_profiler_stack_frame_deduplicator.h
diff --git a/base/trace_event/heap_profiler_stack_frame_deduplicator.h b/base/trace_event/heap_profiler_stack_frame_deduplicator.h
index 66d430f2ee32572aa0732c4105de410a3ac4db27..18cb2459afe1a0af6dc4cc85644f719376d163ab 100644
--- a/base/trace_event/heap_profiler_stack_frame_deduplicator.h
+++ b/base/trace_event/heap_profiler_stack_frame_deduplicator.h
@@ -12,12 +12,12 @@
#include "base/base_export.h"
#include "base/macros.h"
#include "base/trace_event/heap_profiler_allocation_context.h"
-#include "base/trace_event/trace_event_impl.h"
namespace base {
namespace trace_event {
class TraceEventMemoryOverhead;
+class TracedValue;
// A data structure that allows grouping a set of backtraces in a space-
// efficient manner by creating a call tree and writing it as a set of (node,
@@ -26,7 +26,7 @@ class TraceEventMemoryOverhead;
// of |StackFrame|s to index into |frames_|. So there is a trie for bottum-up
// lookup of a backtrace for deduplication, and a tree for compact storage in
// the trace log.
-class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat {
+class BASE_EXPORT StackFrameDeduplicator {
public:
// A node in the call tree.
struct FrameNode {
@@ -49,7 +49,7 @@ class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat {
using ConstIterator = std::vector<FrameNode>::const_iterator;
StackFrameDeduplicator();
- ~StackFrameDeduplicator() override;
+ ~StackFrameDeduplicator();
// Inserts a backtrace where |beginFrame| is a pointer to the bottom frame
// (e.g. main) and |endFrame| is a pointer past the top frame (most recently
@@ -61,16 +61,18 @@ class BASE_EXPORT StackFrameDeduplicator : public ConvertableToTraceFormat {
ConstIterator begin() const { return frames_.begin(); }
ConstIterator end() const { return frames_.end(); }
- // Writes the |stackFrames| dictionary as defined in https://goo.gl/GerkV8 to
- // the trace log.
- void AppendAsTraceFormat(std::string* out) const override;
+ // Appends new |stackFrames| dictionary items that were added after the
+ // last call to this function.
+ // Items are formatted according to https://goo.gl/GerkV8
+ void AppendIncrementally(TracedValue* traced_value);
// Estimates memory overhead including |sizeof(StackFrameDeduplicator)|.
- void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead) override;
+ void EstimateTraceMemoryOverhead(TraceEventMemoryOverhead* overhead);
private:
std::map<StackFrame, int> roots_;
std::vector<FrameNode> frames_;
+ size_t last_appended_index_;
DISALLOW_COPY_AND_ASSIGN(StackFrameDeduplicator);
};

Powered by Google App Engine
This is Rietveld 408576698