• 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 
is_runtime_stats_enabledTracingFlags26   static bool is_runtime_stats_enabled() {
27     return runtime_stats.load(std::memory_order_relaxed) != 0;
28   }
29 
is_gc_enabledTracingFlags30   static bool is_gc_enabled() {
31     return gc.load(std::memory_order_relaxed) != 0;
32   }
33 
is_gc_stats_enabledTracingFlags34   static bool is_gc_stats_enabled() {
35     return gc_stats.load(std::memory_order_relaxed) != 0;
36   }
37 
is_ic_stats_enabledTracingFlags38   static bool is_ic_stats_enabled() {
39     return ic_stats.load(std::memory_order_relaxed) != 0;
40   }
41 
is_zone_stats_enabledTracingFlags42   static bool is_zone_stats_enabled() {
43     return zone_stats.load(std::memory_order_relaxed) != 0;
44   }
45 };
46 
47 }  // namespace internal
48 }  // namespace v8
49 
50 #endif  // V8_LOGGING_TRACING_FLAGS_H_
51