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

Unified Diff: src/counters.h

Issue 2313193002: [Tracing] Fix runtime call stats tracing for GC. (Closed)
Patch Set: update & rebase 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') | src/counters-inl.h » ('J')
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 85d709f0ea1ce99d28a4768e2fdda47aa4adb9e8..7cb9cddd5ef6f9950c45d0adbcfcaf9d067350fa 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)
@@ -1249,45 +1248,28 @@ class Counters {
class RuntimeCallTimerScope {
public:
inline RuntimeCallTimerScope(Isolate* isolate,
- RuntimeCallStats::CounterId counter_id) {
- 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);
- }
- }
+ RuntimeCallStats::CounterId counter_id);
// This constructor is here just to avoid calling GetIsolate() when the
// stats are disabled and the isolate is not directly available.
inline RuntimeCallTimerScope(HeapObject* heap_object,
RuntimeCallStats::CounterId counter_id);
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') | src/counters-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698