v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
compilation-statistics.h
Go to the documentation of this file.
1// Copyright 2014 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_DIAGNOSTICS_COMPILATION_STATISTICS_H_
6#define V8_DIAGNOSTICS_COMPILATION_STATISTICS_H_
7
8#include <map>
9#include <string>
10
14
15namespace v8 {
16namespace internal {
17
18class OptimizedCompilationInfo;
19class CompilationStatistics;
20
26
27class CompilationStatistics final : public Malloced {
28 public:
32
33 class BasicStats {
34 public:
35 void Accumulate(const BasicStats& stats);
36
37 std::string AsJSON();
38
45 std::string function_name_;
46 };
47
48 void RecordPhaseStats(const char* phase_kind_name, const char* phase_name,
49 const BasicStats& stats);
50
51 void RecordPhaseKindStats(const char* phase_kind_name,
52 const BasicStats& stats);
53
54 void RecordTotalStats(const BasicStats& stats);
55
56 private:
57 class TotalStats : public BasicStats {
58 public:
60 uint64_t source_size_;
61 size_t count_;
62 };
63
64 class OrderedStats : public BasicStats {
65 public:
66 explicit OrderedStats(size_t insert_order) : insert_order_(insert_order) {}
68 };
69
70 class PhaseStats : public OrderedStats {
71 public:
72 PhaseStats(size_t insert_order, const char* phase_kind_name)
73 : OrderedStats(insert_order), phase_kind_name_(phase_kind_name) {}
74 std::string phase_kind_name_;
75 };
76
77 friend std::ostream& operator<<(std::ostream& os,
78 const AsPrintableStatistics& s);
79
81 using PhaseKindMap = std::map<std::string, PhaseKindStats>;
82 using PhaseMap = std::map<std::string, PhaseStats>;
83
88};
89
90std::ostream& operator<<(std::ostream& os, const AsPrintableStatistics& s);
91
92} // namespace internal
93} // namespace v8
94
95#endif // V8_DIAGNOSTICS_COMPILATION_STATISTICS_H_
PhaseStats(size_t insert_order, const char *phase_kind_name)
void RecordPhaseStats(const char *phase_kind_name, const char *phase_name, const BasicStats &stats)
CompilationStatistics & operator=(const CompilationStatistics &)=delete
std::map< std::string, PhaseStats > PhaseMap
void RecordPhaseKindStats(const char *phase_kind_name, const BasicStats &stats)
std::map< std::string, PhaseKindStats > PhaseKindMap
friend std::ostream & operator<<(std::ostream &os, const AsPrintableStatistics &s)
CompilationStatistics(const CompilationStatistics &)=delete
void RecordTotalStats(const BasicStats &stats)
std::ostream & operator<<(std::ostream &os, AtomicMemoryOrder order)