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

Unified Diff: runtime/vm/service.cc

Issue 2502283003: Add a version of heap snapshots that use only fields and stack frames as roots and only include ins… (Closed)
Patch Set: . Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/service.h ('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 5e34b4a9a4b17984245b32efc0db562261a07ba0..259b2c03a67b63174c9b5b54e97992165a26546b 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -3244,17 +3244,33 @@ static bool GetHeapMap(Thread* thread, JSONStream* js) {
}
+static const char* snapshot_roots_names[] = {
+ "User", "VM", NULL,
+};
+
+
+static ObjectGraph::SnapshotRoots snapshot_roots_values[] = {
+ ObjectGraph::kUser, ObjectGraph::kVM,
+};
+
+
static const MethodParameter* request_heap_snapshot_params[] = {
RUNNABLE_ISOLATE_PARAMETER,
+ new EnumParameter("roots", false /* not required */, snapshot_roots_names),
new BoolParameter("collectGarbage", false /* not required */), NULL,
};
static bool RequestHeapSnapshot(Thread* thread, JSONStream* js) {
+ ObjectGraph::SnapshotRoots roots = ObjectGraph::kVM;
+ const char* roots_arg = js->LookupParam("roots");
+ if (roots_arg != NULL) {
+ roots = EnumMapper(roots_arg, snapshot_roots_names, snapshot_roots_values);
+ }
const bool collect_garbage =
BoolParameter::Parse(js->LookupParam("collectGarbage"), true);
if (Service::graph_stream.enabled()) {
- Service::SendGraphEvent(thread, collect_garbage);
+ Service::SendGraphEvent(thread, roots, collect_garbage);
}
// TODO(koda): Provide some id that ties this request to async response(s).
JSONObject jsobj(js);
@@ -3263,11 +3279,13 @@ static bool RequestHeapSnapshot(Thread* thread, JSONStream* js) {
}
-void Service::SendGraphEvent(Thread* thread, bool collect_garbage) {
+void Service::SendGraphEvent(Thread* thread,
+ ObjectGraph::SnapshotRoots roots,
+ bool collect_garbage) {
uint8_t* buffer = NULL;
WriteStream stream(&buffer, &allocator, 1 * MB);
ObjectGraph graph(thread);
- intptr_t node_count = graph.Serialize(&stream, collect_garbage);
+ intptr_t node_count = graph.Serialize(&stream, roots, collect_garbage);
// Chrome crashes receiving a single tens-of-megabytes blob, so send the
// snapshot in megabyte-sized chunks instead.
« no previous file with comments | « runtime/vm/service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698