// Copyright 2020 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // This program measures the time taken to decode the given JSON files (the // command line arguments). It is for manual benchmarking. // // Usage: // $ ninja -C out/foobar json_perftest_decodebench // $ out/foobar/json_perftest_decodebench -a -n=10 the/path/to/your/*.json // // The -n=10 switch controls the number of iterations. It defaults to 1. // // The -a switch means to print 1 non-comment line per input file (the average // iteration time). Without this switch (the default), it prints n non-comment // lines per input file (individual iteration times). For a single input file, // building and running this program before and after a particular commit can // work well with the 'ministat' tool: https://github.com/thorduri/ministat #include <inttypes.h> #include <iomanip> #include <iostream> #include "base/command_line.h" #include "base/files/file_util.h" #include "base/json/json_reader.h" #include "base/logging.h" #include "base/time/time.h" int main(int argc, char* argv[]) { … }