| Index: base/trace_event/trace_event_memory_overhead.h
|
| diff --git a/base/trace_event/trace_event_memory_overhead.h b/base/trace_event/trace_event_memory_overhead.h
|
| index 0d5769bdcd3e7516abeed45cc679947614ce6c34..1587a3099f6adfc35fb5533e3b1852e122c18866 100644
|
| --- a/base/trace_event/trace_event_memory_overhead.h
|
| +++ b/base/trace_event/trace_event_memory_overhead.h
|
| @@ -6,12 +6,11 @@
|
| #define BASE_TRACE_EVENT_TRACE_EVENT_MEMORY_OVERHEAD_H_
|
|
|
| #include <stddef.h>
|
| +#include <stdint.h>
|
|
|
| #include <unordered_map>
|
|
|
| #include "base/base_export.h"
|
| -#include "base/containers/hash_tables.h"
|
| -#include "base/containers/small_map.h"
|
| #include "base/macros.h"
|
|
|
| namespace base {
|
| @@ -26,18 +25,35 @@ class ProcessMemoryDump;
|
| // Used to estimate the memory overhead of the tracing infrastructure.
|
| class BASE_EXPORT TraceEventMemoryOverhead {
|
| public:
|
| + enum ObjectType : uint32_t {
|
| + kOther = 0,
|
| + kTraceBuffer,
|
| + kTraceBufferChunk,
|
| + kTraceEvent,
|
| + kUnusedTraceEvent,
|
| + kTracedValue,
|
| + kConvertableToTraceFormat,
|
| + kHeapProfilerAllocationRegister,
|
| + kHeapProfilerTypeNameDeduplicator,
|
| + kHeapProfilerStackFrameDeduplicator,
|
| + kStdString,
|
| + kBaseValue,
|
| + kTraceEventMemoryOverhead,
|
| + kLast
|
| + };
|
| +
|
| TraceEventMemoryOverhead();
|
| ~TraceEventMemoryOverhead();
|
|
|
| // Use this method to account the overhead of an object for which an estimate
|
| // is known for both the allocated and resident memory.
|
| - void Add(const char* object_type,
|
| + void Add(ObjectType object_type,
|
| size_t allocated_size_in_bytes,
|
| size_t resident_size_in_bytes);
|
|
|
| // Similar to Add() above, but assumes that
|
| // |resident_size_in_bytes| == |allocated_size_in_bytes|.
|
| - void Add(const char* object_type, size_t allocated_size_in_bytes);
|
| + void Add(ObjectType object_type, size_t allocated_size_in_bytes);
|
|
|
| // Specialized profiling functions for commonly used object types.
|
| void AddString(const std::string& str);
|
| @@ -49,7 +65,7 @@ class BASE_EXPORT TraceEventMemoryOverhead {
|
| void AddSelf();
|
|
|
| // Retrieves the count, that is, the count of Add*(|object_type|, ...) calls.
|
| - size_t GetCount(const char* object_type) const;
|
| + size_t GetCount(ObjectType object_type) const;
|
|
|
| // Adds up and merges all the values from |other| to this instance.
|
| void Update(const TraceEventMemoryOverhead& other);
|
| @@ -62,14 +78,12 @@ class BASE_EXPORT TraceEventMemoryOverhead {
|
| size_t allocated_size_in_bytes;
|
| size_t resident_size_in_bytes;
|
| };
|
| - using map_type =
|
| - small_map<std::unordered_map<const char*, ObjectCountAndSize>, 16>;
|
| - map_type allocated_objects_;
|
| -
|
| - void AddOrCreateInternal(const char* object_type,
|
| - size_t count,
|
| - size_t allocated_size_in_bytes,
|
| - size_t resident_size_in_bytes);
|
| + ObjectCountAndSize allocated_objects_[ObjectType::kLast];
|
| +
|
| + void AddInternal(ObjectType object_type,
|
| + size_t count,
|
| + size_t allocated_size_in_bytes,
|
| + size_t resident_size_in_bytes);
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TraceEventMemoryOverhead);
|
| };
|
|
|