• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2020 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef V8_LOGGING_TRACING_FLAGS_H_
6 #define V8_LOGGING_TRACING_FLAGS_H_
7 
8 #include <atomic>
9 
10 #include "src/base/macros.h"
11 
12 namespace v8 {
13 namespace internal {
14 
15 // This struct contains a set of flags that can be modified from multiple
16 // threads at runtime unlike the normal FLAG_-like flags which are not modified
17 // after V8 instance is initialized.
18 
19 struct TracingFlags {
20   static V8_EXPORT_PRIVATE std::atomic_uint runtime_stats;
21   static V8_EXPORT_PRIVATE std::atomic_uint gc;
22   static V8_EXPORT_PRIVATE std::atomic_uint gc_stats;
23   static V8_EXPORT_PRIVATE std::atomic_uint ic_stats;
24   static V8_EXPORT_PRIVATE std::atomic_uint zone_stats;
25 
26 #ifdef V8_RUNTIME_CALL_STATS
is_runtime_stats_enabledTracingFlags27   static bool is_runtime_stats_enabled() {
28     return runtime_stats.load(std::memory_order_relaxed) != 0;
29   }
30 #endif
31 
is_gc_enabledTracingFlags32   static bool is_gc_enabled() {
33     return gc.load(std::memory_order_relaxed) != 0;
34   }
35 
is_gc_stats_enabledTracingFlags36   static bool is_gc_stats_enabled() {
37     return gc_stats.load(std::memory_order_relaxed) != 0;
38   }
39 
is_ic_stats_enabledTracingFlags40   static bool is_ic_stats_enabled() {
41     return ic_stats.load(std::memory_order_relaxed) != 0;
42   }
43 
is_zone_stats_enabledTracingFlags44   static bool is_zone_stats_enabled() {
45     return zone_stats.load(std::memory_order_relaxed) != 0;
46   }
47 };
48 
49 }  // namespace internal
50 }  // namespace v8
51 
52 #endif  // V8_LOGGING_TRACING_FLAGS_H_
53