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

Unified Diff: runtime/vm/isolate.cc

Issue 16853006: Object histogramin the vm (--print-object-histogram). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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/isolate.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
===================================================================
--- runtime/vm/isolate.cc (revision 23950)
+++ runtime/vm/isolate.cc (working copy)
@@ -14,6 +14,7 @@
#include "vm/dart_entry.h"
#include "vm/debugger.h"
#include "vm/heap.h"
+#include "vm/heap_histogram.h"
#include "vm/message_handler.h"
#include "vm/object_store.h"
#include "vm/parser.h"
@@ -34,6 +35,13 @@
"Trace isolate creation and shut down.");
DECLARE_FLAG(bool, trace_deoptimization_verbose);
+
+void Isolate::RegisterClass(const Class& cls) {
+ class_table()->Register(cls);
+ if (object_histogram() != NULL) object_histogram()->RegisterClass(cls);
+}
+
+
class IsolateMessageHandler : public MessageHandler {
public:
explicit IsolateMessageHandler(Isolate* isolate);
@@ -400,7 +408,11 @@
deferred_objects_count_(0),
deferred_objects_(NULL),
stacktrace_(NULL),
- stack_frame_index_(-1) {
+ stack_frame_index_(-1),
+ object_histogram_(NULL) {
+ if (FLAG_print_object_histogram && (Dart::vm_isolate() != NULL)) {
+ object_histogram_ = new ObjectHistogram(this);
+ }
}
@@ -418,6 +430,7 @@
mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate.
delete message_handler_;
message_handler_ = NULL; // Fail fast if we send messages to a dead isolate.
+ delete object_histogram_;
}
void Isolate::SetCurrent(Isolate* current) {
@@ -729,6 +742,13 @@
ASSERT(top_resource() == NULL);
ASSERT((heap_ == NULL) || heap_->Verify());
+ if (FLAG_print_object_histogram) {
+ StackZone stack_zone(this);
+ HandleScope handle_scope(this);
+ heap()->CollectAllGarbage();
+ object_histogram()->Print();
+ }
+
// Clean up debugger resources. Shutting down the debugger
// requires a handle zone. We must set up a temporary zone because
// Isolate::Shutdown is called without a zone.
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698