| Index: runtime/vm/dart.cc
|
| diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
|
| index d37c2d76ac2effa682675213c78c5428ba41f75e..9d39c6ccca053a00fc4d702c05ec815887ed7ff1 100644
|
| --- a/runtime/vm/dart.cc
|
| +++ b/runtime/vm/dart.cc
|
| @@ -23,6 +23,8 @@
|
|
|
| namespace dart {
|
|
|
| +DEFINE_FLAG(bool, heap_profile_isolate_initialize, false,
|
| + "Writes a heap profile on isolate initialization.");
|
| DECLARE_FLAG(bool, print_bootstrap);
|
| DECLARE_FLAG(bool, print_class_table);
|
| DECLARE_FLAG(bool, trace_isolates);
|
| @@ -168,6 +170,15 @@ RawError* Dart::InitializeIsolate(const uint8_t* snapshot_buffer, void* data) {
|
| if (FLAG_trace_isolates) {
|
| isolate->heap()->PrintSizes();
|
| }
|
| +
|
| + if (FLAG_heap_profile_isolate_initialize) {
|
| + const char* format = "%s-isolate-initialize.hprof";
|
| + intptr_t len = OS::SNPrint(NULL, 0, format, isolate->name());
|
| + char* filename = isolate->current_zone()->Alloc<char>(len + 1);
|
| + OS::SNPrint(filename, len + 1, format, isolate->name());
|
| + isolate->heap()->ProfileToFile(filename);
|
| + }
|
| +
|
| if (FLAG_print_bootstrap) {
|
| PrintLibrarySources(isolate);
|
| }
|
|
|