src/third_party/mozjs/extract/intl/benchmarks/head.js
/**
 * Create an interface to measure iterations for a micro benchmark. These iterations
 * will then be reported to the perftest runner.
 *
 * @param {string} metricName
 */
Create an interface to measure iterations for a micro benchmark. These iterations
will then be reported to the perftest runner.

@param {string} metricName
Create an interface to measure iterations for a micro benchmark . These iterations will then be reported to the perftest runner . @param { string } metricName
function measureIterations(metricName) {
  let accumulatedTime = 0;
  let iterations = 0;
  let now = 0;
  return {
    start() {
      now = Cu.now();
    },
    stop() {
      accumulatedTime += Cu.now() - now;
      iterations++;
    },
    reportMetrics() {
      const metrics = {};
      metrics[metricName + " iterations"] = iterations;
      metrics[metricName + " accumulatedTime"] = accumulatedTime;
      metrics[metricName + " perCallTime"] = accumulatedTime / iterations;
      info("perfMetrics", metrics);
    },
  };
}
function measureIterations ( metricName ) { let accumulatedTime = 0 ; let iterations = 0 ; let now = 0 ; return { start ( ) { now = Cu . now ( ) ; } , stop ( ) { accumulatedTime += Cu . now ( ) - now ; iterations ++ ; } , reportMetrics ( ) { const metrics = { } ; metrics [ metricName + " iterations" ] = iterations ; metrics [ metricName + " accumulatedTime" ] = accumulatedTime ; metrics [ metricName + " perCallTime" ] = accumulatedTime / iterations ; info ( "perfMetrics" , metrics ) ; } , } ; }
Create an interface to measure iterations for a micro benchmark.
Create an interface to measure iterations for a micro benchmark .
/**
     * Start a measurement.
     */ /**
     * Stop a measurement, and record the elapsed time.
     */ /**
     * Report the metrics to perftest after finishing the microbenchmark.
     */