Functions | |
def | check_input_file (filename) |
def | classify_input_file (filename) |
def | find_benchmark_flag (prefix, benchmark_flags) |
def | is_executable_file (filename) |
def | is_json_file (filename) |
def | load_benchmark_results (fname) |
def | remove_benchmark_flags (prefix, benchmark_flags) |
def | run_benchmark (exe_name, benchmark_flags) |
def | run_or_load_benchmark (filename, benchmark_flags) |
def | sort_benchmark_results (result) |
Variables | |
_num_magic_bytes = 2 if sys.platform.startswith('win') else 4 | |
IT_Executable = 2 | |
IT_Invalid = 0 | |
IT_JSON = 1 | |
util.py - General utilities for running, loading, and processing benchmarks
def gbench.util.check_input_file | ( | filename | ) |
Classify the file named by 'filename' and return the classification. If the file is classified as 'IT_Invalid' print an error message and exit the program.
Definition at line 78 of file benchmark/tools/gbench/util.py.
def gbench.util.classify_input_file | ( | filename | ) |
Return a tuple (type, msg) where 'type' specifies the classified type of 'filename'. If 'type' is 'IT_Invalid' then 'msg' is a human readable string represeting the error.
Definition at line 57 of file benchmark/tools/gbench/util.py.
def gbench.util.find_benchmark_flag | ( | prefix, | |
benchmark_flags | |||
) |
Search the specified list of flags for a flag matching `<prefix><arg>` and if it is found return the arg it specifies. If specified more than once the last value is returned. If the flag is not found None is returned.
Definition at line 91 of file benchmark/tools/gbench/util.py.
def gbench.util.is_executable_file | ( | filename | ) |
Return 'True' if 'filename' names a valid file which is likely an executable. A file is considered an executable if it starts with the magic bytes for a EXE, Mach O, or ELF file.
Definition at line 18 of file benchmark/tools/gbench/util.py.
def gbench.util.is_json_file | ( | filename | ) |
Returns 'True' if 'filename' names a valid JSON output file. 'False' otherwise.
Definition at line 43 of file benchmark/tools/gbench/util.py.
def gbench.util.load_benchmark_results | ( | fname | ) |
Read benchmark output from a file and return the JSON object. REQUIRES: 'fname' names a file containing JSON benchmark output.
Definition at line 114 of file benchmark/tools/gbench/util.py.
def gbench.util.remove_benchmark_flags | ( | prefix, | |
benchmark_flags | |||
) |
Return a new list containing the specified benchmark_flags except those with the specified prefix.
Definition at line 105 of file benchmark/tools/gbench/util.py.
def gbench.util.run_benchmark | ( | exe_name, | |
benchmark_flags | |||
) |
Run a benchmark specified by 'exe_name' with the specified 'benchmark_flags'. The benchmark is run directly as a subprocess to preserve real time console output. RETURNS: A JSON object representing the benchmark output
Definition at line 140 of file benchmark/tools/gbench/util.py.
def gbench.util.run_or_load_benchmark | ( | filename, | |
benchmark_flags | |||
) |
Get the results for a specified benchmark. If 'filename' specifies an executable benchmark then the results are generated by running the benchmark. Otherwise 'filename' must name a valid JSON output file, which is loaded and the result returned.
Definition at line 169 of file benchmark/tools/gbench/util.py.
def gbench.util.sort_benchmark_results | ( | result | ) |
Definition at line 123 of file benchmark/tools/gbench/util.py.
Definition at line 15 of file benchmark/tools/gbench/util.py.
int gbench.util.IT_Executable = 2 |
Definition at line 13 of file benchmark/tools/gbench/util.py.
int gbench.util.IT_Invalid = 0 |
Definition at line 11 of file benchmark/tools/gbench/util.py.
int gbench.util.IT_JSON = 1 |
Definition at line 12 of file benchmark/tools/gbench/util.py.