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

Unified Diff: src/heap.h

Issue 661170: Add information about time spent in external callback to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 10 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 | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap.h
===================================================================
--- src/heap.h (revision 3959)
+++ src/heap.h (working copy)
@@ -1520,8 +1520,23 @@
class GCTracer BASE_EMBEDDED {
public:
+ // Time spent while in the external scope counts towards the
+ // external time in the tracer and will be reported separately.
+ class ExternalScope BASE_EMBEDDED {
+ public:
+ explicit ExternalScope(GCTracer* tracer) : tracer_(tracer) {
+ start_time_ = OS::TimeCurrentMillis();
+ }
+ ~ExternalScope() {
+ tracer_->external_time_ += OS::TimeCurrentMillis() - start_time_;
+ }
+
+ private:
+ GCTracer* tracer_;
+ double start_time_;
+ };
+
GCTracer();
-
~GCTracer();
// Sets the collector.
@@ -1555,6 +1570,9 @@
double start_size_; // Size of objects in heap set in constructor.
GarbageCollector collector_; // Type of collector.
+ // Keep track of the amount of time spent in external callbacks.
+ double external_time_;
+
// A count (including this one, eg, the first collection is 1) of the
// number of garbage collections.
int gc_count_;
« no previous file with comments | « no previous file | src/heap.cc » ('j') | src/heap.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698