aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/bun-types/perf_hooks.d.ts26
-rw-r--r--src/js/node/perf_hooks.js15
2 files changed, 28 insertions, 13 deletions
diff --git a/packages/bun-types/perf_hooks.d.ts b/packages/bun-types/perf_hooks.d.ts
index 802b0e082..792223e6b 100644
--- a/packages/bun-types/perf_hooks.d.ts
+++ b/packages/bun-types/perf_hooks.d.ts
@@ -452,19 +452,19 @@ declare module "perf_hooks" {
// },
// ): void;
// }
- // namespace constants {
- // const NODE_PERFORMANCE_GC_MAJOR: number;
- // const NODE_PERFORMANCE_GC_MINOR: number;
- // const NODE_PERFORMANCE_GC_INCREMENTAL: number;
- // const NODE_PERFORMANCE_GC_WEAKCB: number;
- // const NODE_PERFORMANCE_GC_FLAGS_NO: number;
- // const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
- // const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
- // const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
- // const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
- // const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
- // const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
- // }
+ namespace constants {
+ const NODE_PERFORMANCE_GC_MAJOR: number;
+ const NODE_PERFORMANCE_GC_MINOR: number;
+ const NODE_PERFORMANCE_GC_INCREMENTAL: number;
+ const NODE_PERFORMANCE_GC_WEAKCB: number;
+ const NODE_PERFORMANCE_GC_FLAGS_NO: number;
+ const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
+ const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
+ const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
+ const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
+ const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
+ const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
+ }
const performance: Performance;
// interface EventLoopMonitorOptions {
// /**
diff --git a/src/js/node/perf_hooks.js b/src/js/node/perf_hooks.js
index fb5929c57..592868ab5 100644
--- a/src/js/node/perf_hooks.js
+++ b/src/js/node/perf_hooks.js
@@ -1,6 +1,20 @@
// Hardcoded module "node:perf_hooks"
import { throwNotImplemented } from "../shared";
+export var constants = {
+ NODE_PERFORMANCE_GC_MAJOR: 4,
+ NODE_PERFORMANCE_GC_MINOR: 1,
+ NODE_PERFORMANCE_GC_INCREMENTAL: 8,
+ NODE_PERFORMANCE_GC_WEAKCB: 16,
+ NODE_PERFORMANCE_GC_FLAGS_NO: 0,
+ NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: 2,
+ NODE_PERFORMANCE_GC_FLAGS_FORCED: 4,
+ NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: 8,
+ NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: 16,
+ NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: 32,
+ NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: 64,
+};
+
export var performance = globalThis.performance;
export class PerformanceObserver {
@@ -22,6 +36,7 @@ export class PerformanceNodeTiming {
export default {
performance,
+ constants,
PerformanceEntry,
PerformanceNodeTiming,
[Symbol.for("CommonJS")]: 0,