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

Unified Diff: src/counters.h

Issue 1771323003: [counter] reducing the overhead of RuntimeCallTimerScope (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: further reducing overhead Created 4 years, 9 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 | « src/arguments.h ('k') | src/counters.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.h
diff --git a/src/counters.h b/src/counters.h
index dfcaba953f69eb1d25354713dd4d559645dcb21d..1c91dabc797f0f6e00597268a39d7081b34a3e16 100644
--- a/src/counters.h
+++ b/src/counters.h
@@ -492,8 +492,11 @@ struct RuntimeCallCounter {
// timers used for properly measuring the own time of a RuntimeCallCounter.
class RuntimeCallTimer {
public:
- RuntimeCallTimer(RuntimeCallCounter* counter, RuntimeCallTimer* parent)
- : counter_(counter), parent_(parent) {}
+ inline void Initialize(RuntimeCallCounter* counter,
+ RuntimeCallTimer* parent) {
+ counter_ = counter;
+ parent_ = parent;
+ }
inline void Start() {
timer_.Start();
@@ -509,7 +512,9 @@ class RuntimeCallTimer {
return parent_;
}
- void AdjustForSubTimer(base::TimeDelta delta) { counter_->time -= delta; }
+ inline void AdjustForSubTimer(base::TimeDelta delta) {
+ counter_->time -= delta;
+ }
private:
RuntimeCallCounter* counter_;
@@ -557,8 +562,16 @@ struct RuntimeCallStats {
// the time of C++ scope.
class RuntimeCallTimerScope {
public:
- explicit RuntimeCallTimerScope(Isolate* isolate, RuntimeCallCounter* counter);
- ~RuntimeCallTimerScope();
+ inline explicit RuntimeCallTimerScope(Isolate* isolate,
+ RuntimeCallCounter* counter) {
+ if (FLAG_runtime_call_stats) Enter(isolate, counter);
+ }
+ inline ~RuntimeCallTimerScope() {
+ if (FLAG_runtime_call_stats) Leave();
+ }
+
+ void Enter(Isolate* isolate, RuntimeCallCounter* counter);
+ void Leave();
private:
Isolate* isolate_;
« no previous file with comments | « src/arguments.h ('k') | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698