Functions | Variables
gbench.util Namespace Reference

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)
 

Variables

int _num_magic_bytes = 2 if sys.platform.startswith('win') else 4
 
int IT_Executable = 2
 
int IT_Invalid = 0
 
int IT_JSON = 1
 

Detailed Description

util.py - General utilities for running, loading, and processing benchmarks

Function Documentation

◆ check_input_file()

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 75 of file util.py.

◆ classify_input_file()

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 54 of file util.py.

◆ find_benchmark_flag()

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 87 of file util.py.

◆ is_executable_file()

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 15 of file util.py.

◆ is_json_file()

def gbench.util.is_json_file (   filename)
Returns 'True' if 'filename' names a valid JSON output file.
'False' otherwise.

Definition at line 40 of file util.py.

◆ load_benchmark_results()

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 108 of file util.py.

◆ remove_benchmark_flags()

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 100 of file util.py.

◆ run_benchmark()

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 117 of file util.py.

◆ run_or_load_benchmark()

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 146 of file util.py.

Variable Documentation

◆ _num_magic_bytes

int gbench.util._num_magic_bytes = 2 if sys.platform.startswith('win') else 4
private

Definition at line 14 of file util.py.

◆ IT_Executable

int gbench.util.IT_Executable = 2

Definition at line 12 of file util.py.

◆ IT_Invalid

int gbench.util.IT_Invalid = 0

Definition at line 10 of file util.py.

◆ IT_JSON

int gbench.util.IT_JSON = 1

Definition at line 11 of file util.py.



libaditof
Author(s):
autogenerated on Wed May 21 2025 02:07:08