From 364e864ad2fe3c332c59dfe91adbad00d36c24ad Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Mon, 6 Feb 2012 08:59:43 +0000 Subject: [PATCH] Add timestamp to --trace-gc output. 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 | 2 ++ src/isolate.cc | 1 + src/isolate.h | 7 +++++++ 3 files changed, 10 insertions(+) diff --git a/src/heap.cc b/src/heap.cc index 4c7e33d..4cea933 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(scopes_[Scope::EXTERNAL]); diff --git a/src/isolate.cc b/src/isolate.cc index 82af337..893a344 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; } diff --git a/src/isolate.h b/src/isolate.h index 7e6807b..0e59903 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_; -- 2.7.4