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

Unified Diff: src/counters.h

Issue 2313193002: [Tracing] Fix runtime call stats tracing for GC. (Closed)
Patch Set: Created 4 years, 3 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/api.cc ('k') | src/counters-inl.h » ('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 27ed8776ee665db93d0362529e569ac244ed25a1..18a35386f40f009ec81431be30a28304ebb39e72 100644
--- a/src/counters.h
+++ b/src/counters.h
@@ -810,15 +810,14 @@ class RuntimeCallStats {
#define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \
do { \
- if (FLAG_runtime_call_stats) { \
- RuntimeCallStats::CorrectCurrentCounterId( \
- isolate->counters()->runtime_call_stats(), \
- &RuntimeCallStats::counter_name); \
- } \
if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED())) { \
RuntimeCallStats::CorrectCurrentCounterId( \
isolate->counters()->tracing_runtime_call_stats(), \
&RuntimeCallStats::counter_name); \
+ } else if (FLAG_runtime_call_stats) { \
+ RuntimeCallStats::CorrectCurrentCounterId( \
+ isolate->counters()->runtime_call_stats(), \
+ &RuntimeCallStats::counter_name); \
} \
} while (false)
@@ -1247,17 +1246,17 @@ class RuntimeCallTimerScope {
public:
inline RuntimeCallTimerScope(Isolate* isolate,
RuntimeCallStats::CounterId counter_id) {
- if (V8_UNLIKELY(FLAG_runtime_call_stats)) {
+ if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED())) {
+ isolate_ = isolate;
+ is_tracing_ = true;
+ RuntimeCallStats::Enter(
+ isolate_->counters()->tracing_runtime_call_stats(), &timer_,
+ counter_id);
+ } else if (V8_UNLIKELY(FLAG_runtime_call_stats)) {
isolate_ = isolate;
RuntimeCallStats::Enter(isolate_->counters()->runtime_call_stats(),
&timer_, counter_id);
}
- if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED())) {
- isolate_for_tracing_ = isolate;
- RuntimeCallStats::Enter(
- isolate_for_tracing_->counters()->tracing_runtime_call_stats(),
- &trace_event_timer_, counter_id);
- }
}
// This constructor is here just to avoid calling GetIsolate() when the
// stats are disabled and the isolate is not directly available.
@@ -1265,26 +1264,21 @@ class RuntimeCallTimerScope {
RuntimeCallStats::CounterId counter_id);
Camillo Bruni 2016/09/07 02:00:29 nit: could you declare both constructors in the sa
lpy 2016/09/07 16:48:09 Done.
inline ~RuntimeCallTimerScope() {
- if (V8_UNLIKELY(FLAG_runtime_call_stats)) {
- RuntimeCallStats::Leave(isolate_->counters()->runtime_call_stats(),
- &timer_);
- }
- if (V8_UNLIKELY(isolate_for_tracing_ != nullptr)) {
- RuntimeCallStats::Leave(
- isolate_for_tracing_->counters()->tracing_runtime_call_stats(),
- &trace_event_timer_);
- isolate_for_tracing_ = nullptr;
+ if (V8_UNLIKELY(isolate_ != nullptr)) {
+ if (is_tracing_) {
+ RuntimeCallStats::Leave(
+ isolate_->counters()->tracing_runtime_call_stats(), &timer_);
+ } else {
+ RuntimeCallStats::Leave(isolate_->counters()->runtime_call_stats(),
+ &timer_);
+ }
}
}
private:
- Isolate* isolate_;
- // TODO(lpy): --runtime-call-stats and tracing should be mutually exclusive
- // with tracing taking precendence. We need to add checks, and use a single
- // isolate reference and a timer for both.
- Isolate* isolate_for_tracing_ = nullptr;
+ Isolate* isolate_ = nullptr;
+ bool is_tracing_ = false;
RuntimeCallTimer timer_;
- RuntimeCallTimer trace_event_timer_;
};
} // namespace internal
« no previous file with comments | « src/api.cc ('k') | src/counters-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698