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

Unified Diff: runtime/vm/heap.cc

Issue 434763002: Add VMService GC events (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/heap.cc
===================================================================
--- runtime/vm/heap.cc (revision 39000)
+++ runtime/vm/heap.cc (working copy)
@@ -14,6 +14,7 @@
#include "vm/pages.h"
#include "vm/raw_object.h"
#include "vm/scavenger.h"
+#include "vm/service.h"
#include "vm/stack_frame.h"
#include "vm/tags.h"
#include "vm/verifier.h"
@@ -503,6 +504,10 @@
stats_.after_.old_ = old_space_->GetCurrentUsage();
ASSERT(gc_in_progress_);
gc_in_progress_ = false;
+ if (Service::NeedsGCEvents()) {
+ GCEvent event(stats_);
+ Service::HandleGCEvent(&event);
+ }
}
@@ -560,6 +565,21 @@
}
+void GCEvent::PrintJSON(JSONStream* js) const {
+ Isolate* isolate = Isolate::Current();
+ {
+ JSONObject jsobj(js);
+ jsobj.AddProperty("type", "ServiceEvent");
+ jsobj.AddPropertyF("id", "gc/%" Pd, stats_.num_);
+ jsobj.AddProperty("eventType", "GC"); // TODO(koda): "GarbageCollected"
+ jsobj.AddProperty("isolate", isolate);
+ jsobj.AddProperty("reason", Heap::GCReasonToString(stats_.reason_));
+ isolate->heap()->PrintToJSONObject(Heap::kNew, &jsobj);
+ isolate->heap()->PrintToJSONObject(Heap::kOld, &jsobj);
+ }
+}
+
+
#if defined(DEBUG)
NoGCScope::NoGCScope() : StackResource(Isolate::Current()) {
isolate()->IncrementNoGCScopeDepth();
« no previous file with comments | « runtime/vm/heap.h ('k') | runtime/vm/service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698