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

Unified Diff: src/counters.h

Issue 2461733005: Introduce RuntimeCallStats::IsEnabled (Closed)
Patch Set: Created 4 years, 2 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/compiler-dispatcher/compiler-dispatcher-tracer.cc ('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 0cd0def57a00ea5c06ed1950f4bbe017def32134..bd882aa83817e8ea99f95824fb5a9fe5503ccb20 100644
--- a/src/counters.h
+++ b/src/counters.h
@@ -805,6 +805,13 @@ class RuntimeCallStats {
static void CorrectCurrentCounterId(RuntimeCallStats* stats,
CounterId counter_id);
+ // Returns true if RuntimeCallStats are enabled either through a flag or
+ // with tracing.
+ static bool IsEnabled() {
fmeawad 2016/10/28 21:54:25 Wouldn't that add an extra call per check? Why a m
Camillo Bruni 2016/10/31 09:57:18 From what I've seen so far is that clang inlines v
+ return V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED()) ||
+ FLAG_runtime_call_stats;
Camillo Bruni 2016/10/31 09:57:58 nit: put the V8_UNLIKELY around the whole clause,
+ }
+
void Reset();
void Print(std::ostream& os);
V8_NOINLINE void Dump(v8::tracing::TracedValue* value);
@@ -824,14 +831,13 @@ class RuntimeCallStats {
bool in_use_;
};
-#define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \
- do { \
- if (V8_UNLIKELY(TRACE_EVENT_RUNTIME_CALL_STATS_TRACING_ENABLED() || \
- FLAG_runtime_call_stats)) { \
- RuntimeCallStats::CorrectCurrentCounterId( \
- isolate->counters()->runtime_call_stats(), \
- &RuntimeCallStats::counter_name); \
- } \
+#define TRACE_RUNTIME_CALL_STATS(isolate, counter_name) \
+ do { \
+ if (RuntimeCallStats::IsEnabled()) { \
+ RuntimeCallStats::CorrectCurrentCounterId( \
+ isolate->counters()->runtime_call_stats(), \
+ &RuntimeCallStats::counter_name); \
+ } \
} while (false)
#define TRACE_HANDLER_STATS(isolate, counter_name) \
« no previous file with comments | « src/compiler-dispatcher/compiler-dispatcher-tracer.cc ('k') | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698