-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
perf_hooks: make nodeTiming a first-class object #35977
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
e0b8f00
7d64d79
170242b
166f6b3
778f60b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,51 +165,88 @@ function getMilestoneTimestamp(milestoneIdx) { | |
| return ns / 1e6 - timeOrigin; | ||
| } | ||
|
|
||
| const PerformanceNodeTimingProps = { | ||
| enumerable: true, | ||
| configurable: true | ||
| }; | ||
| class PerformanceNodeTiming extends PerformanceEntry { | ||
| get name() { | ||
| return 'node'; | ||
| } | ||
| constructor() { | ||
| super(); | ||
|
|
||
| get entryType() { | ||
| return 'node'; | ||
| } | ||
| ObjectDefineProperties(this, { | ||
| name: { | ||
| ...PerformanceNodeTimingProps, | ||
| value: 'node' | ||
| }, | ||
|
|
||
| get startTime() { | ||
| return 0; | ||
| } | ||
| entryType: { | ||
| ...PerformanceNodeTimingProps, | ||
| value: 'node' | ||
| }, | ||
|
|
||
| get duration() { | ||
| return now() - timeOrigin; | ||
| } | ||
| startTime: { | ||
| ...PerformanceNodeTimingProps, | ||
| value: 0 | ||
| }, | ||
|
|
||
| get nodeStart() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_NODE_START); | ||
| } | ||
| duration: { | ||
| ...PerformanceNodeTimingProps, | ||
| get() { | ||
| return now() - timeOrigin; | ||
| } | ||
| }, | ||
|
|
||
| get v8Start() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_V8_START); | ||
| } | ||
| nodeStart: { | ||
| ...PerformanceNodeTimingProps, | ||
| get() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_NODE_START); | ||
| } | ||
| }, | ||
|
|
||
| get environment() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_ENVIRONMENT); | ||
| } | ||
| v8Start: { | ||
| ...PerformanceNodeTimingProps, | ||
| get() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_V8_START); | ||
| } | ||
| }, | ||
|
|
||
| get loopStart() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_LOOP_START); | ||
| } | ||
| environment: { | ||
| ...PerformanceNodeTimingProps, | ||
| get() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_ENVIRONMENT); | ||
| } | ||
| }, | ||
|
|
||
| get loopExit() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_LOOP_EXIT); | ||
| } | ||
| loopStart: { | ||
| ...PerformanceNodeTimingProps, | ||
| get() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_LOOP_START); | ||
| } | ||
| }, | ||
|
|
||
| get bootstrapComplete() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE); | ||
| } | ||
| loopExit: { | ||
| ...PerformanceNodeTimingProps, | ||
| get() { | ||
| return getMilestoneTimestamp(NODE_PERFORMANCE_MILESTONE_LOOP_EXIT); | ||
| } | ||
| }, | ||
|
|
||
| get idleTime() { | ||
| return loopIdleTime(); | ||
| } | ||
| bootstrapComplete: { | ||
| ...PerformanceNodeTimingProps, | ||
| get() { | ||
| return getMilestoneTimestamp( | ||
| NODE_PERFORMANCE_MILESTONE_BOOTSTRAP_COMPLETE); | ||
| } | ||
| }, | ||
|
|
||
| idleTime: { | ||
| ...PerformanceNodeTimingProps, | ||
|
||
| get() { | ||
| return loopIdleTime(); | ||
| } | ||
| } | ||
| }); | ||
| } | ||
| [kInspect]() { | ||
| return { | ||
| name: 'node', | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.