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

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

Issue 11478012: Provide a mechanism for dumping of heap profiles on predefined events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/exceptions.cc » ('j') | runtime/vm/exceptions.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/dart.h" 5 #include "vm/dart.h"
6 6
7 #include "vm/code_observers.h" 7 #include "vm/code_observers.h"
8 #include "vm/dart_api_state.h" 8 #include "vm/dart_api_state.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/freelist.h" 10 #include "vm/freelist.h"
11 #include "vm/handles.h" 11 #include "vm/handles.h"
12 #include "vm/heap.h" 12 #include "vm/heap.h"
13 #include "vm/isolate.h" 13 #include "vm/isolate.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/object_store.h" 15 #include "vm/object_store.h"
16 #include "vm/port.h" 16 #include "vm/port.h"
17 #include "vm/snapshot.h" 17 #include "vm/snapshot.h"
18 #include "vm/stub_code.h" 18 #include "vm/stub_code.h"
19 #include "vm/symbols.h" 19 #include "vm/symbols.h"
20 #include "vm/thread_pool.h" 20 #include "vm/thread_pool.h"
21 #include "vm/virtual_memory.h" 21 #include "vm/virtual_memory.h"
22 #include "vm/zone.h" 22 #include "vm/zone.h"
23 23
24 namespace dart { 24 namespace dart {
25 25
26 DEFINE_FLAG(bool, heap_profile_isolate_initialize, false,
27 "Writes a heap profile on isolate initialization.");
26 DECLARE_FLAG(bool, print_bootstrap); 28 DECLARE_FLAG(bool, print_bootstrap);
27 DECLARE_FLAG(bool, print_class_table); 29 DECLARE_FLAG(bool, print_class_table);
28 DECLARE_FLAG(bool, trace_isolates); 30 DECLARE_FLAG(bool, trace_isolates);
29 31
30 Isolate* Dart::vm_isolate_ = NULL; 32 Isolate* Dart::vm_isolate_ = NULL;
31 ThreadPool* Dart::thread_pool_ = NULL; 33 ThreadPool* Dart::thread_pool_ = NULL;
32 void* Dart::perf_events_file_ = NULL; 34 void* Dart::perf_events_file_ = NULL;
33 DebugInfo* Dart::pprof_symbol_generator_ = NULL; 35 DebugInfo* Dart::pprof_symbol_generator_ = NULL;
34 36
35 // An object visitor which will mark all visited objects. This is used to 37 // An object visitor which will mark all visited objects. This is used to
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 ASSERT(snapshot->kind() == Snapshot::kFull); 163 ASSERT(snapshot->kind() == Snapshot::kFull);
162 if (FLAG_trace_isolates) { 164 if (FLAG_trace_isolates) {
163 OS::Print("Size of isolate snapshot = %d\n", snapshot->length()); 165 OS::Print("Size of isolate snapshot = %d\n", snapshot->length());
164 } 166 }
165 SnapshotReader reader(snapshot->content(), snapshot->length(), 167 SnapshotReader reader(snapshot->content(), snapshot->length(),
166 Snapshot::kFull, isolate); 168 Snapshot::kFull, isolate);
167 reader.ReadFullSnapshot(); 169 reader.ReadFullSnapshot();
168 if (FLAG_trace_isolates) { 170 if (FLAG_trace_isolates) {
169 isolate->heap()->PrintSizes(); 171 isolate->heap()->PrintSizes();
170 } 172 }
173
174 if (FLAG_heap_profile_isolate_initialize) {
175 const char* format = "%s-isolate-initialize.hprof";
176 intptr_t len = OS::SNPrint(NULL, 0, format, isolate->name());
177 char* filename = isolate->current_zone()->Alloc<char>(len + 1);
178 OS::SNPrint(filename, len + 1, format, isolate->name());
179 isolate->heap()->ProfileToFile(filename);
180 }
181
171 if (FLAG_print_bootstrap) { 182 if (FLAG_print_bootstrap) {
172 PrintLibrarySources(isolate); 183 PrintLibrarySources(isolate);
173 } 184 }
174 } 185 }
175 186
176 StubCode::Init(isolate); 187 StubCode::Init(isolate);
177 isolate->heap()->EnableGrowthControl(); 188 isolate->heap()->EnableGrowthControl();
178 isolate->set_init_callback_data(data); 189 isolate->set_init_callback_data(data);
179 if (FLAG_print_class_table) { 190 if (FLAG_print_class_table) {
180 isolate->class_table()->Print(); 191 isolate->class_table()->Print();
(...skipping 12 matching lines...) Expand all
193 delete isolate; 204 delete isolate;
194 205
195 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); 206 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback();
196 if (callback != NULL) { 207 if (callback != NULL) {
197 (callback)(callback_data); 208 (callback)(callback_data);
198 } 209 }
199 } 210 }
200 211
201 212
202 } // namespace dart 213 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/exceptions.cc » ('j') | runtime/vm/exceptions.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698