| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
| 6 | 6 |
| 7 #if defined(DART_USE_TCMALLOC) && !defined(PRODUCT) | 7 #if defined(DART_USE_TCMALLOC) && !defined(PRODUCT) |
| 8 | 8 |
| 9 #include "vm/malloc_hooks.h" | 9 #include "vm/malloc_hooks.h" |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 | 217 |
| 218 void MallocHooks::ResetStats() { | 218 void MallocHooks::ResetStats() { |
| 219 MutexLocker ml(MallocHooksState::malloc_hook_mutex()); | 219 MutexLocker ml(MallocHooksState::malloc_hook_mutex()); |
| 220 ASSERT(MallocHooksState::initialized()); | 220 ASSERT(MallocHooksState::initialized()); |
| 221 | 221 |
| 222 MallocHooksState::ResetStats(); | 222 MallocHooksState::ResetStats(); |
| 223 } | 223 } |
| 224 | 224 |
| 225 | 225 |
| 226 bool MallocHooks::Initialized() { |
| 227 return MallocHooksState::initialized(); |
| 228 } |
| 229 |
| 230 |
| 226 intptr_t MallocHooks::allocation_count() { | 231 intptr_t MallocHooks::allocation_count() { |
| 227 MutexLocker ml(MallocHooksState::malloc_hook_mutex()); | 232 MutexLocker ml(MallocHooksState::malloc_hook_mutex()); |
| 228 return MallocHooksState::allocation_count(); | 233 return MallocHooksState::allocation_count(); |
| 229 } | 234 } |
| 230 | 235 |
| 231 | 236 |
| 232 intptr_t MallocHooks::heap_allocated_memory_in_bytes() { | 237 intptr_t MallocHooks::heap_allocated_memory_in_bytes() { |
| 233 MutexLocker ml(MallocHooksState::malloc_hook_mutex()); | 238 MutexLocker ml(MallocHooksState::malloc_hook_mutex()); |
| 234 return MallocHooksState::heap_allocated_memory_in_bytes(); | 239 return MallocHooksState::heap_allocated_memory_in_bytes(); |
| 235 } | 240 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 if (MallocHooksState::address_map()->Lookup(ptr, &size)) { | 274 if (MallocHooksState::address_map()->Lookup(ptr, &size)) { |
| 270 MallocHooksState::DecrementHeapAllocatedMemoryInBytes(size); | 275 MallocHooksState::DecrementHeapAllocatedMemoryInBytes(size); |
| 271 MallocHooksState::address_map()->Remove(ptr); | 276 MallocHooksState::address_map()->Remove(ptr); |
| 272 } | 277 } |
| 273 } | 278 } |
| 274 } | 279 } |
| 275 | 280 |
| 276 } // namespace dart | 281 } // namespace dart |
| 277 | 282 |
| 278 #endif // defined(DART_USE_TCMALLOC) && !defined(PRODUCT) | 283 #endif // defined(DART_USE_TCMALLOC) && !defined(PRODUCT) |
| OLD | NEW |