Node.js  v8.x
Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine
node_perf_common.h
Go to the documentation of this file.
1 #ifndef SRC_NODE_PERF_COMMON_H_
2 #define SRC_NODE_PERF_COMMON_H_
3 
4 #include "node.h"
5 #include "v8.h"
6 
7 #include <map>
8 #include <string>
9 
10 namespace node {
11 namespace performance {
12 
13 #define PERFORMANCE_NOW() uv_hrtime()
14 
15 // These occur before the environment is created. Cache them
16 // here and add them to the milestones when the env is init'd.
17 extern uint64_t performance_node_start;
18 extern uint64_t performance_v8_start;
19 
20 #define NODE_PERFORMANCE_MILESTONES(V) \
21  V(ENVIRONMENT, "environment") \
22  V(NODE_START, "nodeStart") \
23  V(V8_START, "v8Start") \
24  V(LOOP_START, "loopStart") \
25  V(LOOP_EXIT, "loopExit") \
26  V(BOOTSTRAP_COMPLETE, "bootstrapComplete") \
27  V(THIRD_PARTY_MAIN_START, "thirdPartyMainStart") \
28  V(THIRD_PARTY_MAIN_END, "thirdPartyMainEnd") \
29  V(CLUSTER_SETUP_START, "clusterSetupStart") \
30  V(CLUSTER_SETUP_END, "clusterSetupEnd") \
31  V(MODULE_LOAD_START, "moduleLoadStart") \
32  V(MODULE_LOAD_END, "moduleLoadEnd") \
33  V(PRELOAD_MODULE_LOAD_START, "preloadModulesLoadStart") \
34  V(PRELOAD_MODULE_LOAD_END, "preloadModulesLoadEnd")
35 
36 #define NODE_PERFORMANCE_ENTRY_TYPES(V) \
37  V(NODE, "node") \
38  V(MARK, "mark") \
39  V(MEASURE, "measure") \
40  V(GC, "gc") \
41  V(FUNCTION, "function")
42 
44 #define V(name, _) NODE_PERFORMANCE_MILESTONE_##name,
46 #undef V
48 };
49 
51 #define V(name, _) NODE_PERFORMANCE_ENTRY_TYPE_##name,
53 #undef V
55 };
56 
57 #define PERFORMANCE_MARK(env, n) \
58  do { \
59  node::performance::MarkPerformanceMilestone(env, \
60  node::performance::NODE_PERFORMANCE_MILESTONE_##n); \
61  } while (0);
62 
64  // doubles first so that they are always sizeof(double)-aligned
67 };
68 
69 } // namespace performance
70 } // namespace node
71 
72 #endif // SRC_NODE_PERF_COMMON_H_
double milestones[NODE_PERFORMANCE_MILESTONE_INVALID]
uint64_t performance_v8_start
Definition: node_perf.cc:32
uint32_t observers[NODE_PERFORMANCE_ENTRY_TYPE_INVALID]
#define NODE_PERFORMANCE_ENTRY_TYPES(V)
#define NODE_PERFORMANCE_MILESTONES(V)
#define V(name, _)
uint64_t performance_node_start
Definition: node_perf.cc:31