diff --git a/bindings/profilers/wall.cc b/bindings/profilers/wall.cc index 6c6e5db1..11564677 100644 --- a/bindings/profilers/wall.cc +++ b/bindings/profilers/wall.cc @@ -42,17 +42,25 @@ struct TimeTicks { static int64_t Now(); }; } // namespace base -#if NODE_MAJOR_VERSION >= 24 +#if NODE_MAJOR_VERSION >= 22 + +// Available from 22.7.0 +#define DD_WALL_USE_CPED true + namespace internal { -#if NODE_MAJOR_VERSION == 24 +#if NODE_MAJOR_VERSION < 25 struct HandleScopeData { v8::internal::Address* next; v8::internal::Address* limit; }; -#endif +#endif // NODE_MAJOR_VERSION < 25 +#if NODE_MAJOR_VERSION >= 24 constexpr int kHandleBlockSize = v8::internal::KB - 2; +#endif // NODE_MAJOR_VERSION >= 24 } // namespace internal -#endif +#else // NODE_MAJOR_VERSION >= 22 +#define DD_WALL_USE_CPED false +#endif // } // namespace v8 static int64_t Now() { @@ -61,18 +69,14 @@ static int64_t Now() { #else #define DD_WALL_USE_SIGPROF false +#define DD_WALL_USE_CPED false + static int64_t Now() { return 0; }; #endif -#if NODE_MAJOR_VERSION >= 23 -#define DD_WALL_USE_CPED true -#else -#define DD_WALL_USE_CPED false -#endif - using namespace v8; namespace dd { @@ -905,7 +909,12 @@ NAN_METHOD(WallProfiler::New) { #if !DD_WALL_USE_CPED if (useCPED) { return Nan::ThrowTypeError( - "useCPED is not supported on this Node.js version."); +#ifndef _WIN32 + "useCPED is not supported on this Node.js version." +#else + "useCPED is not supported on Windows." +#endif + ); } #endif diff --git a/ts/src/index.ts b/ts/src/index.ts index 42454629..51cceddb 100644 --- a/ts/src/index.ts +++ b/ts/src/index.ts @@ -40,7 +40,6 @@ export const time = { v8ProfilerStuckEventLoopDetected: timeProfiler.v8ProfilerStuckEventLoopDetected, getState: timeProfiler.getState, - getMetrics: timeProfiler.getMetrics, constants: timeProfiler.constants, }; diff --git a/ts/test/test-time-profiler.ts b/ts/test/test-time-profiler.ts index 6c5b8e00..1c887525 100644 --- a/ts/test/test-time-profiler.ts +++ b/ts/test/test-time-profiler.ts @@ -29,8 +29,10 @@ import {satisfies} from 'semver'; import assert from 'assert'; const useCPED = - satisfies(process.versions.node, '>=24.0.0') && - !process.execArgv.includes('--no-async-context-frame'); + (satisfies(process.versions.node, '>=24.0.0') && + !process.execArgv.includes('--no-async-context-frame')) || + (satisfies(process.versions.node, '>=22.7.0') && + process.execArgv.includes('--experimental-async-context-frame')); const collectAsyncId = satisfies(process.versions.node, '>=24.0.0'); diff --git a/ts/test/worker.ts b/ts/test/worker.ts index eeffd3c3..bcc7d147 100644 --- a/ts/test/worker.ts +++ b/ts/test/worker.ts @@ -13,8 +13,11 @@ const intervalMicros = 10000; const withContexts = process.platform === 'darwin' || process.platform === 'linux'; const useCPED = - satisfies(process.versions.node, '>=24.0.0') && - !process.execArgv.includes('--no-async-context-frame'); + withContexts && + ((satisfies(process.versions.node, '>=24.0.0') && + !process.execArgv.includes('--no-async-context-frame')) || + (satisfies(process.versions.node, '>=22.7.0') && + process.execArgv.includes('--experimental-async-context-frame'))); const collectAsyncId = withContexts && satisfies(process.versions.node, '>=24.0.0'); diff --git a/ts/test/worker2.ts b/ts/test/worker2.ts index e06f5578..eaacd07c 100644 --- a/ts/test/worker2.ts +++ b/ts/test/worker2.ts @@ -10,8 +10,11 @@ const withContexts = process.platform === 'darwin' || process.platform === 'linux'; const useCPED = - satisfies(process.versions.node, '>=24.0.0') && - !process.execArgv.includes('--no-async-context-frame'); + withContexts && + ((satisfies(process.versions.node, '>=24.0.0') && + !process.execArgv.includes('--no-async-context-frame')) || + (satisfies(process.versions.node, '>=22.7.0') && + process.execArgv.includes('--experimental-async-context-frame'))); const collectAsyncId = withContexts && satisfies(process.versions.node, '>=24.0.0');