Add timestamp to --trace-gc output.
authoryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 6 Feb 2012 08:59:43 +0000 (08:59 +0000)
committeryangguo@chromium.org <yangguo@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Mon, 6 Feb 2012 08:59:43 +0000 (08:59 +0000)
BUG=v8:1932
TEST=

Review URL: https://chromiumcodereview.appspot.com/9307116

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10604 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/heap.cc
src/isolate.cc
src/isolate.h

index 4c7e33d20c061f7cfdeb59eb54ee89028752fe55..4cea9331b1205b2fca4e87a92dd8a9982186ae79 100644 (file)
@@ -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 82af337d905f15b4bcda189453e8708bae85956f..893a344b511e22818362a0dd748c8c1dec280948 100644 (file)
@@ -1834,6 +1834,7 @@ bool Isolate::Init(Deserializer* des) {
   }
 
   state_ = INITIALIZED;
+  time_millis_at_init_ = OS::TimeCurrentMillis();
   return true;
 }
 
index 7e6807b0a9d3a28538a21a57839419fbb286d7db..0e59903454a043844f36045cacdd514b7f03d6f7 100644 (file)
@@ -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_;