1 #ifndef SRC_NODE_PERF_H_ 2 #define SRC_NODE_PERF_H_ 4 #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 19 namespace performance {
21 using v8::FunctionCallbackInfo;
28 #define V(name, label) \ 29 if (strcmp(str, label) == 0) return NODE_PERFORMANCE_MILESTONE_##name; 37 #define V(name, label) \ 38 if (strcmp(type, label) == 0) return NODE_PERFORMANCE_ENTRY_TYPE_##name; 44 const double MAX_DOUBLE = std::numeric_limits<double>::max();
52 class PerformanceEntry :
public BaseObject {
66 startTime_(startTime),
70 std::string name()
const {
74 std::string type()
const {
78 uint64_t startTime()
const {
82 uint64_t endTime()
const {
98 static void NotifyObservers(Environment* env, PerformanceEntry* entry);
100 static void New(
const FunctionCallbackInfo<Value>& args);
102 PerformanceEntry(Environment* env,
108 BaseObject(env, wrap),
111 startTime_(startTime),
113 MakeWeak<PerformanceEntry>(
this);
114 NotifyObservers(env,
this);
117 PerformanceEntry(Environment* env,
120 BaseObject(env, wrap),
123 startTime_(data->startTime()),
124 endTime_(data->endTime()) {
125 MakeWeak<PerformanceEntry>(
this);
126 NotifyObservers(env,
this);
129 ~PerformanceEntry() {}
131 std::string name()
const {
135 std::string type()
const {
139 double startTime()
const {
140 return startTime_ / 1e6;
143 double duration()
const {
144 return durationNano() / 1e6;
147 uint64_t startTimeNano()
const {
151 uint64_t durationNano()
const {
152 return endTime_ - startTime_;
162 enum PerformanceGCKind {
163 NODE_PERFORMANCE_GC_MAJOR = GCType::kGCTypeMarkSweepCompact,
164 NODE_PERFORMANCE_GC_MINOR = GCType::kGCTypeScavenge,
165 NODE_PERFORMANCE_GC_INCREMENTAL = GCType::kGCTypeIncrementalMarking,
166 NODE_PERFORMANCE_GC_WEAKCB = GCType::kGCTypeProcessWeakCallbacks
172 #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS 174 #endif // SRC_NODE_PERF_H_
#define PERFORMANCE_NOW()
union node::cares_wrap::@8::CaresAsyncData::@0 data
char * Data(Local< Value > val)
#define NODE_PERFORMANCE_ENTRY_TYPES(V)
MaybeLocal< Object > New(Isolate *isolate, Local< String > string, enum encoding enc)
#define NODE_PERFORMANCE_MILESTONES(V)