mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
node: added perf_hooks module definition
This commit is contained in:
@@ -29,6 +29,7 @@ import * as dns from "dns";
|
||||
import * as async_hooks from "async_hooks";
|
||||
import * as http2 from "http2";
|
||||
import * as inspector from "inspector";
|
||||
import * as perf_hooks from "perf_hooks";
|
||||
import Module = require("module");
|
||||
|
||||
// Specifically test buffer module regression.
|
||||
@@ -3086,6 +3087,38 @@ namespace v8_tests {
|
||||
v8.setFlagsFromString('--collect_maps');
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// PerfHooks tests : https://nodejs.org/api/perf_hooks.html
|
||||
////////////////////////////////////////////////////
|
||||
namespace perf_hooks_tests {
|
||||
perf_hooks.performance.mark('start');
|
||||
(
|
||||
() => {}
|
||||
)();
|
||||
perf_hooks.performance.mark('end');
|
||||
|
||||
const { duration } = perf_hooks.performance.getEntriesByName('discover')[0];
|
||||
const timeOrigin = perf_hooks.performance.timeOrigin;
|
||||
const {
|
||||
bootstrapComplete,
|
||||
clusterSetupEnd,
|
||||
clusterSetupStart,
|
||||
duration: dur,
|
||||
entryType,
|
||||
kind,
|
||||
loopExit,
|
||||
loopStart,
|
||||
moduleLoadEnd,
|
||||
moduleLoadStart,
|
||||
preloadModuleLoadEnd,
|
||||
preloadModuleLoadStart,
|
||||
startTime,
|
||||
thirdPartyMainEnd,
|
||||
thirdPartyMainStart,
|
||||
v8Start,
|
||||
} = perf_hooks.performanceNodeTiming;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
/// AsyncHooks tests : https://nodejs.org/api/async_hooks.html
|
||||
////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user