Skia
2D Graphics Library
SkTraceMemoryDump.h
Go to the documentation of this file.
1 /*
2  * Copyright 2015 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkTraceMemoryDump_DEFINED
9 #define SkTraceMemoryDump_DEFINED
10 
11 #include "include/core/SkTypes.h"
12 
13 class SkDiscardableMemory;
14 
20 class SK_API SkTraceMemoryDump {
21 public:
26  // Dump only the minimal details to get the total memory usage (Usually just the totals).
28 
29  // Dump the detailed breakdown of the objects in the caches.
30  kObjectsBreakdowns_LevelOfDetail
31  };
32 
48  virtual void dumpNumericValue(const char* dumpName,
49  const char* valueName,
50  const char* units,
51  uint64_t value) = 0;
52 
53  virtual void dumpStringValue(const char* /*dumpName*/,
54  const char* /*valueName*/,
55  const char* /*value*/) { }
56 
62  virtual void setMemoryBacking(const char* dumpName,
63  const char* backingType,
64  const char* backingObjectId) = 0;
65 
70  const char* dumpName,
71  const SkDiscardableMemory& discardableMemoryObject) = 0;
72 
78  virtual LevelOfDetail getRequestedDetails() const = 0;
79 
84  virtual bool shouldDumpWrappedObjects() const { return true; }
85 
90  virtual void dumpWrappedState(const char* /*dumpName*/, bool /*isWrappedObject*/) {}
91 
98  virtual bool shouldDumpUnbudgetedObjects() const { return true; }
99 
105  virtual void dumpBudgetedState(const char* /*dumpName*/, bool /*isBudgeted*/) {}
106 
107 protected:
108  virtual ~SkTraceMemoryDump() = default;
109  SkTraceMemoryDump() = default;
112 };
113 
114 #endif
Interface for memory tracing.
Definition: SkTraceMemoryDump.h:20
virtual void setMemoryBacking(const char *dumpName, const char *backingType, const char *backingObjectId)=0
Sets the memory backing for an existing dump.
SkTraceMemoryDump(const SkTraceMemoryDump &)=delete
SkTraceMemoryDump()=default
virtual void setDiscardableMemoryBacking(const char *dumpName, const SkDiscardableMemory &discardableMemoryObject)=0
Specialization for memory backed by discardable memory.
virtual LevelOfDetail getRequestedDetails() const =0
Returns the type of details requested in the dump.
virtual ~SkTraceMemoryDump()=default
virtual bool shouldDumpUnbudgetedObjects() const
Returns true if we should dump unbudgeted objects.
Definition: SkTraceMemoryDump.h:98
LevelOfDetail
Enum to specify the level of the requested details for the dump from the Skia objects.
Definition: SkTraceMemoryDump.h:25
@ kLight_LevelOfDetail
Definition: SkTraceMemoryDump.h:27
SkTraceMemoryDump & operator=(const SkTraceMemoryDump &)=delete
virtual void dumpWrappedState(const char *, bool)
If shouldDumpWrappedObjects() returns true then this function will be called to populate the output w...
Definition: SkTraceMemoryDump.h:90
virtual void dumpStringValue(const char *, const char *, const char *)
Definition: SkTraceMemoryDump.h:53
virtual void dumpBudgetedState(const char *, bool)
If shouldDumpUnbudgetedObjects() returns true then this function will be called to populate the outpu...
Definition: SkTraceMemoryDump.h:105
virtual bool shouldDumpWrappedObjects() const
Returns true if we should dump wrapped objects.
Definition: SkTraceMemoryDump.h:84
virtual void dumpNumericValue(const char *dumpName, const char *valueName, const char *units, uint64_t value)=0
Appends a new memory dump (i.e.