Skip to content

Commit

Permalink
process: make test less flaky
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Jan 7, 2025
1 parent 8873e5e commit 5d77130
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions test/parallel/test-process-threadCpuUsage-worker-threads.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,15 @@ function validateResults(results) {
//
// All process CPU usages should be the same. Technically they should have returned the same
// value but since we measure it at different times they vary a little bit.
// Let's allow a tolerance of 5%
// Let's allow a tolerance of 20%
//
ok(processDifference > 0.95);
ok(processDifference < 1.05);
ok(processDifference > 0.8);
ok(processDifference < 1.2);

//
// Each thread is configured so that the performLoad schedules a new hash with an interval two times bigger of the
// previous thread. In theory this should give each thread a load about half of the previous one.
// But since we can't really predict CPU scheduling, we just verify a minimum difference of 20% and a monotonic
// increasing sequence.
// But since we can't really predict CPU scheduling, we just check a monotonic increasing sequence.
//
ok(threadDifference > 1.2);
}
Expand Down

0 comments on commit 5d77130

Please sign in to comment.