test: fix conversion of microseconds in test · nodejs/node@9d84641

Original file line numberDiff line numberDiff line change

@@ -17,14 +17,14 @@ while (Date.now() - now < RUN_FOR_MS);

1717

// Get a diff reading from when we started.

1818

const diff = process.cpuUsage(start);

1919
20-

const MICROSECONDS_PER_SECOND = 1000 * 1000;

20+

const MICROSECONDS_PER_MILLISECOND = 1000;

2121
2222

// Diff usages should be >= 0, <= ~RUN_FOR_MS millis.

2323

// Let's be generous with the slop factor, defined above, in case other things

2424

// are happening on this CPU. The <= check may be invalid if the node process

2525

// is making use of multiple CPUs, in which case, just remove it.

2626

assert(diff.user >= 0);

27-

assert(diff.user <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_SECOND);

27+

assert(diff.user <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_MILLISECOND);

2828
2929

assert(diff.system >= 0);

30-

assert(diff.system <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_SECOND);

30+

assert(diff.system <= SLOP_FACTOR * RUN_FOR_MS * MICROSECONDS_PER_MILLISECOND);