Chromium Code Reviews| Index: base/trace_event/trace_event_memory_overhead.cc |
| diff --git a/base/trace_event/trace_event_memory_overhead.cc b/base/trace_event/trace_event_memory_overhead.cc |
| index 5ece315c00f30485ee0dce9c997b83de6007f3ee..243d007ea654310f6188cd46cd32eb6a9e124c47 100644 |
| --- a/base/trace_event/trace_event_memory_overhead.cc |
| +++ b/base/trace_event/trace_event_memory_overhead.cc |
| @@ -6,18 +6,13 @@ |
| #include <algorithm> |
| +#include "base/bits.h" |
| #include "base/memory/ref_counted_memory.h" |
| #include "base/strings/stringprintf.h" |
| #include "base/trace_event/memory_allocator_dump.h" |
| #include "base/trace_event/process_memory_dump.h" |
| #include "base/values.h" |
| -namespace { |
| -size_t RoundUp(size_t size, size_t alignment) { |
| - return (size + alignment - 1) & ~(alignment - 1); |
| -} |
| -} // namespace |
| - |
| namespace base { |
| namespace trace_event { |
| @@ -62,8 +57,8 @@ void TraceEventMemoryOverhead::AddString(const std::string& str) { |
| // std::string implementations: |
| // - even short string end up malloc()-inc at least 32 bytes. |
| // - longer stings seem to malloc() multiples of 16 bytes. |
|
Lei Zhang
2015/07/24 01:36:48
BTW, typo: "stings"
Primiano Tucci (use gerrit)
2015/07/24 09:37:38
Ah, thanks
|
| - Add("std::string", |
| - sizeof(std::string) + std::max<size_t>(RoundUp(str.capacity(), 16), 32u)); |
| + const size_t capacity = bits::Align(str.capacity(), 16); |
| + Add("std::string", sizeof(std::string) + std::max<size_t>(capacity, 32u)); |
| } |
| void TraceEventMemoryOverhead::AddRefCountedString( |