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

Side by Side Diff: runtime/vm/service.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_unsupported.cc ('k') | no next file » | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/service.h" 5 #include "vm/service.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "include/dart_native_api.h" 8 #include "include/dart_native_api.h"
9 #include "platform/globals.h" 9 #include "platform/globals.h"
10 10
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/cpu.h" 12 #include "vm/cpu.h"
13 #include "vm/dart_api_impl.h" 13 #include "vm/dart_api_impl.h"
14 #include "vm/dart_api_state.h" 14 #include "vm/dart_api_state.h"
15 #include "vm/dart_entry.h" 15 #include "vm/dart_entry.h"
16 #include "vm/debugger.h" 16 #include "vm/debugger.h"
17 #include "vm/isolate.h" 17 #include "vm/isolate.h"
18 #include "vm/lockers.h" 18 #include "vm/lockers.h"
19 #include "vm/malloc_hooks.h"
19 #include "vm/message.h" 20 #include "vm/message.h"
20 #include "vm/message_handler.h" 21 #include "vm/message_handler.h"
21 #include "vm/native_entry.h" 22 #include "vm/native_entry.h"
22 #include "vm/native_arguments.h" 23 #include "vm/native_arguments.h"
23 #include "vm/native_symbol.h" 24 #include "vm/native_symbol.h"
24 #include "vm/object.h" 25 #include "vm/object.h"
25 #include "vm/object_graph.h" 26 #include "vm/object_graph.h"
26 #include "vm/object_id_ring.h" 27 #include "vm/object_id_ring.h"
27 #include "vm/object_store.h" 28 #include "vm/object_store.h"
28 #include "vm/parser.h" 29 #include "vm/parser.h"
(...skipping 3765 matching lines...) Expand 10 before | Expand all | Expand 10 after
3794 jsobj.AddProperty("targetCPU", CPU::Id()); 3795 jsobj.AddProperty("targetCPU", CPU::Id());
3795 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware()); 3796 jsobj.AddProperty("hostCPU", HostCPUFeatures::hardware());
3796 jsobj.AddProperty("version", Version::String()); 3797 jsobj.AddProperty("version", Version::String());
3797 jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart"); 3798 jsobj.AddProperty("_profilerMode", FLAG_profile_vm ? "VM" : "Dart");
3798 jsobj.AddProperty("_nativeZoneMemoryUsage", 3799 jsobj.AddProperty("_nativeZoneMemoryUsage",
3799 ApiNativeScope::current_memory_usage()); 3800 ApiNativeScope::current_memory_usage());
3800 jsobj.AddProperty64("pid", OS::ProcessId()); 3801 jsobj.AddProperty64("pid", OS::ProcessId());
3801 jsobj.AddProperty64("_maxRSS", OS::MaxRSS()); 3802 jsobj.AddProperty64("_maxRSS", OS::MaxRSS());
3802 jsobj.AddPropertyTimeMillis( 3803 jsobj.AddPropertyTimeMillis(
3803 "startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis()); 3804 "startTime", OS::GetCurrentTimeMillis() - Dart::UptimeMillis());
3805 if (MallocHooks::Initialized()) {
3806 jsobj.AddProperty("_heapAllocatedMemoryUsage",
3807 MallocHooks::heap_allocated_memory_in_bytes());
3808 jsobj.AddProperty("_heapAllocationCount", MallocHooks::allocation_count());
3809 }
3804 // Construct the isolate list. 3810 // Construct the isolate list.
3805 { 3811 {
3806 JSONArray jsarr(&jsobj, "isolates"); 3812 JSONArray jsarr(&jsobj, "isolates");
3807 ServiceIsolateVisitor visitor(&jsarr); 3813 ServiceIsolateVisitor visitor(&jsarr);
3808 Isolate::VisitIsolates(&visitor); 3814 Isolate::VisitIsolates(&visitor);
3809 } 3815 }
3810 } 3816 }
3811 3817
3812 3818
3813 static bool GetVM(Thread* thread, JSONStream* js) { 3819 static bool GetVM(Thread* thread, JSONStream* js) {
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
4129 if (strcmp(method_name, method.name) == 0) { 4135 if (strcmp(method_name, method.name) == 0) {
4130 return &method; 4136 return &method;
4131 } 4137 }
4132 } 4138 }
4133 return NULL; 4139 return NULL;
4134 } 4140 }
4135 4141
4136 #endif // !PRODUCT 4142 #endif // !PRODUCT
4137 4143
4138 } // namespace dart 4144 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/malloc_hooks_unsupported.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698