Report benchmark result
173756
public function report()
    {
        $result = parent::aggregate();

        $result['memory'] = array_map(function($v){ return $v . 'MB'; }, $result['memory']);

        // report time benchmark
        $lines[] = 'Time: ' . ($result['time'] ?? 0) . ' msec';

        // report memory benchmark
        $lines[] = 'Memory: ';
        $lines[] = ' alloc: ' . $result['memory']['alloc'];
        $lines[] = ' alloc_real: ' . $result['memory']['alloc_real'];
        $lines[] = ' peak: ' . $result['memory']['peak'];
        $lines[] = ' peak_real: ' . $result['memory']['peak_real'];

        foreach($lines as $line){
            $this->logger->debug($line);
        }

        $this->reported = true;
    }
151692
def _report(self, blocknr, blocksize, size):
        '''  '''

        current = blocknr * blocksize
        sys.stdout.write("\r{0:.2f}%".format(100.0 * current / size))
430890
function runMicroBenchmarks(lists, resources) {
  console.log('Run micro bench...');
  // Create adb engine to use in benchmark
  const { engine, serialized } = createEngine(lists, resources, {
    loadCosmeticFilters: true,
    loadNetworkFilters: true,
  }, true /* Also serialize engine */);

  const filters = getFiltersFromLists(lists);
  const combinedLists = filters.join('\n');
  const { networkFilters, cosmeticFilters } = parseFilters(combinedLists);
  const results = {};

  // Arguments shared among benchmarks
  const args = {
    lists,
    resources,
    engine,
    filters,
    serialized,
    networkFilters,
    cosmeticFilters,
    combinedLists,
  };

  [
    benchCosmeticsFiltersParsing,
    benchEngineCreation,
    benchEngineDeserialization,
    benchEngineSerialization,
    benchGetCosmeticTokens,
    benchGetNetworkTokens,
    benchNetworkFiltersParsing,
    benchStringHashing,
    benchStringTokenize,
    benchGetCosmeticsFilters,
  ].forEach((bench) => {
    if (bench.name.toLowerCase().includes(GREP)) {
      const suite = new Benchmark.Suite();
      suite.add(bench.name, () => bench(args)).on('cycle', (event) => {
        results[bench.name] = {
          opsPerSecond: event.target.hz,
          relativeMarginOfError: event.target.stats.rme,
          numberOfSamples: event.target.stats.sample.length,
        };
      }).run({ async: false });
    }
  });

  return {
    engineStats: {
      numFilters: engine.size,
      numCosmeticFilters: engine.cosmetics.size,
      numExceptionFilters: engine.exceptions.size,
      numImportantFilters: engine.importants.size,
      numRedirectFilters: engine.redirects.size,
    },
    microBenchmarks: results,
  };
}
728485
def benchmark_method(f):
    ""
    @wraps(f)
    def inner(name, *args, **kwargs):
        return Benchmark(name, f, args, kwargs)
    return inner
955259
public function printBenchmarkSummary(Benchmark $benchmark, array $results)
    {
        $averagedResults = array_map(function ($result) {
                return array_sum($result) / count($result);
            }, $results);

        $template = "%s | %s | %s | %s | %s\n";
        asort($averagedResults);
        reset($averagedResults);
        $fastestResult = each($averagedResults);
        printf($template, "Test Name", "Results", "Time", "+ Interval", "Change");
        printf($template, "---------", "-------", "----", "----------", "------");
        foreach ($averagedResults as $name => $result) {
            $interval = $result - $fastestResult["value"];
            $change   = round((1 - $result / $fastestResult["value"]) * 100, 0);
            if ($change == 0) {
                $change = 'baseline';
            } else {
                $faster = true; // Cant really ever be faster, now can it
                if ($change < 0) {
                    $faster = false;
                    $change *= -1;
                }
                $change .= '% ' . ($faster ? 'faster' : 'slower');
            }
            printf(
                $template,
                $name,
                number_format(count($results[$name])),
                sprintf("%.10f", $result),
                "+" . sprintf("%.10f", $interval),
                $change
            );
        }
    }
1235192
def check_existing_results(self, benchmark):
        
        if os.path.exists(benchmark.log_folder):
            sys.exit('Output directory {0} already exists, will not overwrite existing results.'.format(benchmark.log_folder))
        if os.path.exists(benchmark.log_zip):
            sys.exit('Output archive {0} already exists, will not overwrite existing results.'.format(benchmark.log_zip))
239047
def create_benchmark(name, log_file, level=logging.INFO):
    
    handler = logging.FileHandler(log_file)
    rtf_handler = RotatingFileHandler(log_file, maxBytes=30000, backupCount=0)
    formatter = logging.Formatter('%(asctime)s [%(levelname)s] %(name)s: %(message)s')
    handler.setFormatter(formatter)
    logger = logging.getLogger(name)
    logger.setLevel(level)
    logger.addHandler(handler)
    logger.addHandler(rtf_handler)
    return logger
964259
protected void reportCachePerformance ()
    {
        if (/* Log.getLevel() != Log.log.DEBUG || */
            _improv == null ||
            _cacheStatThrottle.throttleOp()) {
            return;
        }

        // compute our estimated memory usage
        long amem = 0;
        int asize = 0;
        synchronized (_atiles) {
            // first total up the active tiles
            Iterator<SoftReference<Tile>> iter = _atiles.values().iterator();
            while (iter.hasNext()) {
                SoftReference<Tile> sref = iter.next();
                Tile tile = sref.get();
                if (tile != null) {
                    asize++;
                    amem += tile.getEstimatedMemoryUsage();
                }
            }
        }
        log.info("Tile caches", "amem", (amem / 1024) + "k",
            "tmem", (Tile._totalTileMemory / 1024) + "k", "seen", _atiles.size(), "asize", + asize);
    }
41861
def benchmark_data(self):
        
        return self.fetch[self.benchmark_type](
            self.benchmark_code,
            self.account.start_date,
            self.account.end_date
        )
637715
double run_benchmark() {
    // use the lesser of 40MB or 10% of Heap
    final long M = Math.min(10000000l, Runtime.getRuntime().maxMemory()/40);
    int[] vals = MemoryManager.malloc4((int)M);
    double total;
    int repeats = 20;
    Timer timer = new Timer(); //ms
    long sum = 0;
    // write repeats * M ints
    // read  repeats * M ints
    for (int l=repeats-1; l>=0; --l) {
      for (int i=0; i<M; ++i) {
        vals[i] = i + l;
      }
      sum = 0;
      for (int i=0; i<M; ++i) {
        sum += vals[i];
      }
    }
    total = (double)timer.time()/1000./repeats;
    //use the sum in a way that doesn't affect the result (don't want the compiler to optimize it away)
    double time = total + ((M*(M-1)/2) - sum); // == total
    return (double)2*M*4/time; //(read+write) * 4 bytes
  }
327586
function benchmark(fn, times, name){
	fn = fn.toString();
	var s = fn.indexOf('{')+1,
		e = fn.lastIndexOf('}');
	fn = fn.substring(s,e);

	return benchmarkString(fn, times, name);
}
805115
def report(self):
        

        # We need only the first 4 significant digits
        tt = (str(self._endtime - self._starttime))[:4]

        self.log('\n%s finished in %s seconds.' % (__pkg_name__, tt))
        self.log('%d directories parsed, %d files copied' %
                 (self._numdirs, self._numfiles))
        if self._numdelfiles:
            self.log('%d files were purged.' % self._numdelfiles)
        if self._numdeldirs:
            self.log('%d directories were purged.' % self._numdeldirs)
        if self._numnewdirs:
            self.log('%d directories were created.' % self._numnewdirs)
        if self._numupdates:
            self.log('%d files were updated by timestamp.' % self._numupdates)

        # Failure stats
        self.log('')
        if self._numcopyfld:
            self.log('there were errors in copying %d files.'
                     % self._numcopyfld)
        if self._numdirsfld:
            self.log('there were errors in creating %d directories.'
                     % self._numdirsfld)
        if self._numupdsfld:
            self.log('there were errors in updating %d files.'
                     % self._numupdsfld)
        if self._numdeldfld:
            self.log('there were errors in purging %d directories.'
                     % self._numdeldfld)
        if self._numdelffld:
            self.log('there were errors in purging %d files.'
                     % self._numdelffld)
891477
def run_benchmarks(dir, models, wav, alphabet, lm_binary=None, trie=None, iters=-1):
    
    '''

    assert_valid_dir(dir)

    inference_times = [ ]

    for model in models:
        model_filename = model

        current_model = {
          'name':   model,
          'iters':  [ ],
          'mean':   numpy.infty,
          'stddev': numpy.infty
        }

        if lm_binary and trie:
            cmdline = './deepspeech --model "%s" --alphabet "%s" --lm "%s" --trie "%s" --audio "%s" -t' % (model_filename, alphabet, lm_binary, trie, wav)
        else:
            cmdline = './deepspeech --model "%s" --alphabet "%s" --audio "%s" -t' % (model_filename, alphabet, wav)

        for it in range(iters):
            sys.stdout.write('\rRunning %s: %d/%d' % (os.path.basename(model), (it+1), iters))
            sys.stdout.flush()
            rc, stdout, stderr = exec_command(cmdline, cwd=dir)
            if rc == 0:
                inference_time = float(stdout.split('\n')[1].split('=')[-1])
                # print("[%d] model=%s inference=%f" % (it, model, inference_time))
                current_model['iters'].append(inference_time)
            else:
                print('exec_command("%s") failed with rc=%d' % (cmdline, rc))
                print('stdout: %s' % stdout)
                print('stderr: %s' % stderr)
                raise AssertionError('Execution failure: rc=%d' % (rc))

        sys.stdout.write('\n')
        sys.stdout.flush()
        current_model['mean']   = numpy.mean(current_model['iters'])
        current_model['stddev'] = numpy.std(current_model['iters'])
        inference_times.append(current_model)

    return inference_times
885312
def run(self, **kwargs):
        '''
        
        '''
        self.report_start()
        for bench in self.benchmarks:
            bench = bench(before=self.report_before_method,
                      after=self.report_after_method,
                      after_each=self.report_progress,
                      debug=self.debug,
                      **kwargs)
            self.report_before_class(bench)
            bench.run()
            self.report_after_class(bench)
            self.runned.append(bench)
        self.report_end()
807635
def report(output)
      output.title(title)

      if total_requests == 0
        output << "None found.\n"
        return
      end

      days = [1, timespan].max
      output.table({}, { align: :right }, { type: :ratio, width: :rest, treshold: 0.15 }) do |rows|
        @hour_frequencies.each_with_index do |requests, index|
          ratio            = requests.to_f / total_requests.to_f
          requests_per_day = (requests / days).ceil
          rows << ["#{index.to_s.rjust(3)}:00", '%d hits/day' % requests_per_day, ratio]
        end
      end
    end
95037
def validate(self, benchmarks):
        
        class_code = self.setup_src
        instance_creation = '\ninstance = {}'.format(self.stmt)
        for i, benchmark in enumerate(benchmarks):
            if not benchmark.result_validation:
                break

            validation_code = class_code + instance_creation + '\nvalidation_result = ' + benchmark.stmt
            validation_scope = {}
            exec(validation_code, validation_scope)
            # Store the result in the first function in the group.
            if i == 0:
                compare_against_function = benchmarks[0].callable.__name__
                compare_against_result = validation_scope['validation_result']
                logging.info('PyPerform: Validating group "{b.group}" against method '
                             '"{b.classname}.{b.callable.__name__}"'.format(b=benchmarks[0]))
            else:
                if compare_against_result == validation_scope['validation_result']:
                    logging.info('PyPerform: Validating {b.classname}.{b.callable.__name__}......PASSED!'
                                 .format(b=benchmark))
                else:
                    error = 'Results of functions {0} and {1} are not equivalent.\n{0}:\t {2}\n{1}:\t{3}'
                    raise ValidationError(error.format(compare_against_function, benchmark.callable.__name__,
                                              compare_against_result, validation_scope['validation_result']))
1227695
function reportResult(devRes, scriptRes, method) {
    		debug('in performRetry', devRes, scriptRes, method);
    		var returnData = {
    			'numAttempts': context.currentAttempt,
    			'maxAttempts': context.maxAttempts,
    			// 'startTime': new Date(),
    			// 'finishTime': new Date(),
    			'scriptRes': scriptRes,
    			'evalStr': context.evalStr,
    			'delay': context.delay,
    			'register': context.register,
    		};
    		var devResKeys = Object.keys(devRes);
    		devResKeys.forEach(function(key) {
    			returnData[key] = devRes[key];
    		});
    		valChecker.defered[method](returnData);
    	}