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

Unified Diff: runtime/vm/service.cc

Issue 1124153006: Heap snapshot visualizations (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: sync Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
« runtime/vm/object_graph.h ('K') | « runtime/vm/object_graph.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/service.cc
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 074c1925d405a6487bde5a710645c60f3e86e5fe..e40d39bea7f179a24628d539a1b7a84d7972fbf4 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -2252,19 +2252,35 @@ void Service::SendGraphEvent(Isolate* isolate) {
uint8_t* buffer = NULL;
WriteStream stream(&buffer, &allocator, 1 * MB);
ObjectGraph graph(isolate);
- graph.Serialize(&stream);
- JSONStream js;
- {
- JSONObject jsobj(&js);
+ intptr_t node_count = graph.Serialize(&stream);
+
+ // Chrome crashes receiving a single tens-of-megabytes blob, so send the
+ // snapshot in megabyte-sized chunks instead.
koda 2015/05/19 20:12:36 Add named constant for chunk size.
rmacnak 2015/05/19 22:16:08 Done.
+ intptr_t num_chunks = (stream.bytes_written() + (MB - 1)) / MB;
+ for (intptr_t i = 0; i < num_chunks; i++) {
+ JSONStream js;
{
- JSONObject event(&jsobj, "event");
- event.AddProperty("type", "ServiceEvent");
- event.AddProperty("eventType", "_Graph");
- event.AddProperty("isolate", isolate);
+ JSONObject jsobj(&js);
+ {
+ JSONObject event(&jsobj, "event");
+ event.AddProperty("type", "ServiceEvent");
+ event.AddProperty("eventType", "_Graph");
+ event.AddProperty("isolate", isolate);
+
+ event.AddProperty("i", i);
+ event.AddProperty("n", num_chunks);
+ event.AddProperty("nodeCount", node_count);
+ }
}
+ const String& message = String::Handle(String::New(js.ToCString()));
+
+ uint8_t* chunk_start = buffer + (i * MB);
+ intptr_t chunk_size = (i + 1 == num_chunks)
koda 2015/05/19 20:12:35 Does this do the right thing when the last chunk i
rmacnak 2015/05/19 22:16:08 No, fixed.
+ ? stream.bytes_written() % MB
+ : MB;
+
+ SendEvent(message, chunk_start, chunk_size);
}
- const String& message = String::Handle(String::New(js.ToCString()));
- SendEvent(message, buffer, stream.bytes_written());
}
« runtime/vm/object_graph.h ('K') | « runtime/vm/object_graph.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698