Skip to content

Commit

Permalink
perf_hooks: fix loop delay resolution validation
Browse files Browse the repository at this point in the history
Fixes: #38160

PR-URL: #38166
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
aduh95 authored and Flarna committed Apr 11, 2021
1 parent 993a1da commit 548cbf0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/node_perf.cc
Expand Up @@ -237,7 +237,7 @@ void LoopIdleTime(const FunctionCallbackInfo<Value>& args) {
void ELDHistogram::New(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
CHECK(args.IsConstructCall());
int32_t resolution = args[0].As<Int32>()->Value();
int64_t resolution = args[0].As<Integer>()->Value();
CHECK_GT(resolution, 0);
new ELDHistogram(env, args.This(), resolution);
}
Expand All @@ -253,7 +253,7 @@ void ELDHistogram::Initialize(Environment* env, Local<Object> target) {
ELDHistogram::ELDHistogram(
Environment* env,
Local<Object> wrap,
int32_t interval)
int64_t interval)
: IntervalHistogram(
env,
wrap,
Expand Down
2 changes: 1 addition & 1 deletion src/node_perf.h
Expand Up @@ -166,7 +166,7 @@ class ELDHistogram : public IntervalHistogram {
ELDHistogram(
Environment* env,
v8::Local<v8::Object> wrap,
int32_t interval);
int64_t interval);

void OnInterval() override;

Expand Down
2 changes: 1 addition & 1 deletion test/sequential/test-performance-eventloopdelay.js
Expand Up @@ -39,7 +39,7 @@ const { sleep } = require('internal/util');
);
});

[-1, 0, Infinity].forEach((i) => {
[-1, 0, 2 ** 53, Infinity].forEach((i) => {
assert.throws(
() => monitorEventLoopDelay({ resolution: i }),
{
Expand Down

0 comments on commit 548cbf0

Please sign in to comment.