v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
profiler-stats.h
Go to the documentation of this file.
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_PROFILER_PROFILER_STATS_H_
6#define V8_PROFILER_PROFILER_STATS_H_
7
8#include <atomic>
9
10namespace v8 {
11namespace internal {
12
13// Stats are used to diagnose the reasons for dropped or unnattributed frames.
15 public:
16 enum Reason {
17 // Reasons we fail to record a TickSample.
20 // These all generate a TickSample.
26
28 };
29
31 static ProfilerStats stats;
32 return &stats;
33 }
34
35 void AddReason(Reason reason);
36 void Clear();
37 void Print() const;
38
39 private:
40 ProfilerStats() = default;
41 static const char* ReasonToString(Reason reason);
42
43 std::atomic_int counts_[Reason::kNumberOfReasons] = {};
44};
45
46} // namespace internal
47} // namespace v8
48
49#endif // V8_PROFILER_PROFILER_STATS_H_
static ProfilerStats * Instance()
static const char * ReasonToString(Reason reason)
std::atomic_int counts_[Reason::kNumberOfReasons]
void AddReason(Reason reason)