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

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

Issue 2702233002: [Experimental, DO NOT LAND] bucket num 4
Patch Set: impl 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_HEAP_PROFILER_ALLOCATION_REGISTER_H_ 5 #ifndef BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_
6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_ 6 #define BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/bits.h" 13 #include "base/bits.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/address_hasher.h"
16 #include "base/process/process_metrics.h" 17 #include "base/process/process_metrics.h"
17 #include "base/template_util.h" 18 #include "base/template_util.h"
18 #include "base/trace_event/heap_profiler_allocation_context.h" 19 #include "base/trace_event/heap_profiler_allocation_context.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 21
21 namespace base { 22 namespace base {
22 namespace trace_event { 23 namespace trace_event {
23 24
24 class AllocationRegisterTest; 25 class AllocationRegisterTest;
25 26
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 // and decremented when the allocation is removed. When the 335 // and decremented when the allocation is removed. When the
335 // number drops to zero, the backtrace is removed from the map. 336 // number drops to zero, the backtrace is removed from the map.
336 BacktraceHasher>; 337 BacktraceHasher>;
337 338
338 struct AllocationInfo { 339 struct AllocationInfo {
339 size_t size; 340 size_t size;
340 const char* type_name; 341 const char* type_name;
341 BacktraceMap::KVIndex backtrace_index; 342 BacktraceMap::KVIndex backtrace_index;
342 }; 343 };
343 344
344 struct AddressHasher {
345 size_t operator () (const void* address) const;
346 };
347
348 using AllocationMap = internal::FixedHashMap< 345 using AllocationMap = internal::FixedHashMap<
349 kAllocationBuckets, 346 kAllocationBuckets,
350 const void*, 347 const void*,
351 AllocationInfo, 348 AllocationInfo,
352 AddressHasher>; 349 AddressHasher>;
353 350
354 BacktraceMap::KVIndex InsertBacktrace(const Backtrace& backtrace); 351 BacktraceMap::KVIndex InsertBacktrace(const Backtrace& backtrace);
355 void RemoveBacktrace(BacktraceMap::KVIndex index); 352 void RemoveBacktrace(BacktraceMap::KVIndex index);
356 353
357 Allocation GetAllocation(AllocationMap::KVIndex) const; 354 Allocation GetAllocation(AllocationMap::KVIndex) const;
358 355
359 AllocationMap allocations_; 356 AllocationMap allocations_;
360 BacktraceMap backtraces_; 357 BacktraceMap backtraces_;
361 358
362 DISALLOW_COPY_AND_ASSIGN(AllocationRegister); 359 DISALLOW_COPY_AND_ASSIGN(AllocationRegister);
363 }; 360 };
364 361
365 } // namespace trace_event 362 } // namespace trace_event
366 } // namespace base 363 } // namespace base
367 364
368 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_ 365 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_
OLDNEW
« no previous file with comments | « base/memory/shared_memory_tracker.cc ('k') | base/trace_event/heap_profiler_allocation_register.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698