v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
profiler-stats.cc
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
6
7#include <algorithm>
8
10
11namespace v8 {
12namespace internal {
13
15 counts_[reason].fetch_add(1, std::memory_order_relaxed);
16}
17
19 for (int i = 0; i < Reason::kNumberOfReasons; i++) {
20 counts_[i].store(0, std::memory_order_relaxed);
21 }
22}
23
25 base::OS::Print("ProfilerStats:\n");
26 for (int i = 0; i < Reason::kNumberOfReasons; i++) {
27 base::OS::Print(" %-30s\t\t %d\n", ReasonToString(static_cast<Reason>(i)),
28 counts_[i].load(std::memory_order_relaxed));
29 }
30}
31
32// static
34 switch (reason) {
35 case kTickBufferFull:
36 return "kTickBufferFull";
38 return "kIsolateNotLocked";
40 return "kSimulatorFillRegistersFailed";
41 case kNoFrameRegion:
42 return "kNoFrameRegion";
43 case kInCallOrApply:
44 return "kInCallOrApply";
46 return "kNoSymbolizedFrames";
47 case kNullPC:
48 return "kNullPC";
50 return "kNumberOfReasons";
51 }
52}
53
54} // namespace internal
55} // namespace v8
static const char * ReasonToString(Reason reason)
std::atomic_int counts_[Reason::kNumberOfReasons]
void AddReason(Reason reason)