How to use the perf_hooks.performance.mark function in perf_hooks

To help you get started, we’ve selected a few perf_hooks examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elbywan / wretch / test / node / wretch.spec.ts View on Github external
function (url, opts) {
        performance.mark(url + " - begin")
        const { fetch } = abortableFetch(nodeFetch) as any
        return fetch(url, opts).then(_ => {
            performance.mark(url + " - end")
            const measure = () => performance.measure(_.url, url + " - begin", url + " - end")
            performance.clearMarks(url + " - begin")
            if(timeout)
                setTimeout(measure, timeout)
            else
                measure()
            return _
        })
    }
github graalvm / graaljs / test / parallel / test-trace-events-api.js View on Github external
setTimeout(() => {
    performance.mark('B');
    performance.measure('A to B', 'A', 'B');
  }, 1);
github graalvm / graaljs / test / parallel / test-trace-events-perf.js View on Github external
setTimeout(() => {
    performance.mark('B');
    performance.measure('A to B', 'A', 'B');
  }, 1);
github bcinarli / uxr / build / logger.js View on Github external
const perf = name => {
    if (measures.includes(name)) {
        performance.mark(`${name}_end`);
        performance.measure(`${name} start to ${name} end`, name, `${name}_end`);
        //let measure = performance.getEntriesByName(`${name} start to ${name} end`)[0];
        //log(`${name} Done in ${(measure.duration/1000).toFixed(2)}s.`);

        clearPerf(name);
    }

    else {
        performance.mark(name);
        const obs = new PerformanceObserver((list, observer) => {
            console.log(list.getEntries());
            observer.disconnect();
        });
        measures.push(name);
    }
};
github embark-framework / embark / src / lib / modules / library_manager / npmTimer.js View on Github external
function(){ 
        performance.mark(self._ongoingMark);
        performance.measure(self._downloadOngoing, self._startMark, self._ongoingMark); 
      }, this._interval);
  }
github fastify / fastify-routes-stats / index.js View on Github external
fastify.addHook('preHandler', function (request, reply, next) {
    const id = request.raw.id
    performance.mark(PREHANDLER + id)
    next()
  })
github shinnn / read-json-sync / benchmark / runner.js View on Github external
deepEqual(fn(fixtureString), [1]);
	deepEqual(fn(fixtureBufferWithBom), [3]);
	deepEqual(fn(fixtureStringWithBom, 'utf8'), [3]);

	performance.mark('start');

	for (const [fixtureName, fixture] of new Map([
		['buffer           ', fixtureBuffer],
		['string           ', fixtureString],
		['buffer with BOM  ', fixtureBufferWithBom],
		['string with BOM  ', fixtureStringWithBom]
	])) {
		const marks = [`${fixtureName} start`, `${fixtureName} end`];
		let i = 1500000;

		performance.mark(marks[0]);

		while (i--) {
			fn(fixture);
		}

		performance.mark(marks[1]);
		performance.measure(fixtureName, ...marks);
	}

	performance.mark('end');
	performance.measure('sum', 'start', 'end');
})();
github batiste / blop-language / experiments / language.js View on Github external
function parse(input, debug) {
  performance.mark('A');
  var stream = tokenizer.tokenize(tokensDefinition, input);
  performance.mark('B');
  var tree = parser.parse(grammar, stream, debug);
  performance.mark('C');
  if(!tree.success) {
    utils.displayError(input, stream, tokensDefinition, grammar, tree)
  }
  return tree
}
github batiste / blop-language / experiments / language.js View on Github external
function parse(input, debug) {
  performance.mark('A');
  var stream = tokenizer.tokenize(tokensDefinition, input);
  performance.mark('B');
  var tree = parser.parse(grammar, stream, debug);
  performance.mark('C');
  if(!tree.success) {
    utils.displayError(input, stream, tokensDefinition, grammar, tree)
  }
  return tree
}
github batiste / blop-language / experiments / language.js View on Github external
function parse(input, debug) {
  performance.mark('A');
  var stream = tokenizer.tokenize(tokensDefinition, input);
  performance.mark('B');
  var tree = parser.parse(grammar, stream, debug);
  performance.mark('C');
  if(!tree.success) {
    utils.displayError(input, stream, tokensDefinition, grammar, tree)
  }
  return tree
}

perf_hooks

placeholder for Node core module

MIT
Latest version published 7 years ago

Package Health Score

47 / 100
Full package analysis

Similar packages