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

Side by Side Diff: runtime/vm/malloc_hooks.cc

Issue 2667743004: Surfaced native heap memory allocation information to the Observatory (Closed)
Patch Set: Added method to check if MallocHooks have been initialized. 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
« no previous file with comments | « runtime/vm/malloc_hooks.h ('k') | runtime/vm/malloc_hooks_unsupported.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « runtime/vm/malloc_hooks.h ('k') | runtime/vm/malloc_hooks_unsupported.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698