Reviewers: Jakob,

Message:
PTAL.

Description:
Add timestamp to --trace-gc output.


BUG=v8:1932
TEST=


Please review this at http://codereview.chromium.org/9307116/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/heap.cc
  M src/isolate.h
  M src/isolate.cc


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index 4c7e33d20c061f7cfdeb59eb54ee89028752fe55..4cea9331b1205b2fca4e87a92dd8a9982186ae79 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -6595,6 +6595,8 @@ GCTracer::~GCTracer() {
     }
   }

+  PrintF("%8.0f ms: ", heap_->isolate()->time_millis_since_init());
+
   if (!FLAG_trace_gc_nvp) {
     int external_time = static_cast<int>(scopes_[Scope::EXTERNAL]);

Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index 82af337d905f15b4bcda189453e8708bae85956f..893a344b511e22818362a0dd748c8c1dec280948 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1834,6 +1834,7 @@ bool Isolate::Init(Deserializer* des) {
   }

   state_ = INITIALIZED;
+  time_millis_at_init_ = OS::TimeCurrentMillis();
   return true;
 }

Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 7e6807b0a9d3a28538a21a57839419fbb286d7db..0e59903454a043844f36045cacdd514b7f03d6f7 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -1030,6 +1030,10 @@ class Isolate {
     context_exit_happened_ = context_exit_happened;
   }

+  double time_millis_since_init() {
+    return OS::TimeCurrentMillis() - time_millis_at_init_;
+  }
+
  private:
   Isolate();

@@ -1200,6 +1204,9 @@ class Isolate {
   // that a context was recently exited.
   bool context_exit_happened_;

+  // Time stamp at initialization.
+  double time_millis_at_init_;
+
 #if defined(V8_TARGET_ARCH_ARM) && !defined(__arm__) || \
     defined(V8_TARGET_ARCH_MIPS) && !defined(__mips__)
   bool simulator_initialized_;


--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev

Reply via email to