| OLD | NEW |
| 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 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 static const size_t kAllocationBuckets = 1 << 18; | 309 static const size_t kAllocationBuckets = 1 << 18; |
| 310 static const size_t kAllocationCapacity = 1500000; | 310 static const size_t kAllocationCapacity = 1500000; |
| 311 #else | 311 #else |
| 312 static const size_t kAllocationBuckets = 1 << 19; | 312 static const size_t kAllocationBuckets = 1 << 19; |
| 313 static const size_t kAllocationCapacity = 5000000; | 313 static const size_t kAllocationCapacity = 5000000; |
| 314 #endif | 314 #endif |
| 315 | 315 |
| 316 // 2^16 works well with BacktraceHasher. When increasing this number make | 316 // 2^16 works well with BacktraceHasher. When increasing this number make |
| 317 // sure BacktraceHasher still produces low number of collisions. | 317 // sure BacktraceHasher still produces low number of collisions. |
| 318 static const size_t kBacktraceBuckets = 1 << 16; | 318 static const size_t kBacktraceBuckets = 1 << 16; |
| 319 #if defined(OS_ANDROID) | 319 static const size_t kBacktraceCapacity = 60000; |
| 320 static const size_t kBacktraceCapacity = 32000; // 22K was observed | |
| 321 #else | |
| 322 static const size_t kBacktraceCapacity = 55000; // 45K was observed on Linux | |
| 323 #endif | |
| 324 | 320 |
| 325 struct BacktraceHasher { | 321 struct BacktraceHasher { |
| 326 size_t operator () (const Backtrace& backtrace) const; | 322 size_t operator () (const Backtrace& backtrace) const; |
| 327 }; | 323 }; |
| 328 | 324 |
| 329 using BacktraceMap = internal::FixedHashMap< | 325 using BacktraceMap = internal::FixedHashMap< |
| 330 kBacktraceBuckets, | 326 kBacktraceBuckets, |
| 331 Backtrace, | 327 Backtrace, |
| 332 size_t, // Number of references to the backtrace (the key). Incremented | 328 size_t, // Number of references to the backtrace (the key). Incremented |
| 333 // when an allocation that references the backtrace is inserted, | 329 // when an allocation that references the backtrace is inserted, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 359 AllocationMap allocations_; | 355 AllocationMap allocations_; |
| 360 BacktraceMap backtraces_; | 356 BacktraceMap backtraces_; |
| 361 | 357 |
| 362 DISALLOW_COPY_AND_ASSIGN(AllocationRegister); | 358 DISALLOW_COPY_AND_ASSIGN(AllocationRegister); |
| 363 }; | 359 }; |
| 364 | 360 |
| 365 } // namespace trace_event | 361 } // namespace trace_event |
| 366 } // namespace base | 362 } // namespace base |
| 367 | 363 |
| 368 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_ | 364 #endif // BASE_TRACE_EVENT_HEAP_PROFILER_ALLOCATION_REGISTER_H_ |
| OLD | NEW |