parser.py
PROGRAM [edit section]
parser.py
DESCRIPTION [edit section]
parser.py in a python program that is used by each benchmark test to parse the test log for a test run, check the threshold(s) for success or failure, and store the data used to generate plots.Each benchmark should include an executable file called 'parser.py' in the test directory (/fuego-core/engine/tests/Benchmark.<testname>).
The test log for the current run is parsed by this routine, and one or more metrics are extracted (using regular expressions).
input files [edit section]
The file used to specify the threshold and comparison operator for each metric is called reference.log. The metric names for the benchmark are stored in a file called metrics.json.
output files [edit section]
The output data is placed in a file called plot.data, and a plot image is created in the file plot.png.
outline [edit section]
The program has the following rough outline:- import the parser library
- specify a search pattern for finding one or more metrics from the test log
- call the parse() function
- build a dictionary of metric values
- call the process_data function
metric names [edit section]
The parser.py program provides the name for the metric(s) read from the benchmark test log file. It also provide a value for each metric, and passes the parsed data value for each metric to the processing routine.This metric name must be consistent in the tests.info file, and the reference.log file.
SAMPLES [edit section]
Here is a sample parser.py that does simple processing of a single metric. This is for Benchmark.GLMark
#!/bin/python # See common.py for description of command-line arguments import os, re, sys sys.path.insert(0, os.environ['FUEGO_CORE'] + '/engine/scripts/parser') import common as plib ref_section_pat = "\[[\w]+.[gle]{2}\]" cur_search_pat = re.compile("^(Your GLMark08 Score is )([\d]{1,3})",re.MULTILINE) cur_dict = {} pat_result = plib.parse(cur_search_pat) if pat_result: cur_dict["GLMark_Score"] = pat_result[0][1] sys.exit(plib.process_data(ref_section_pat, cur_dict, 's', 'FPS'))
ENVIRONMENT and ARGUMENTS [edit section]
parser.py takes takes positional arguments on its command line.- $JOB_NAME
- $PLATFORM
- $BUILD_ID
- $BUILD_NUMBER
- $FW
- $PLATFORM
- $NODE_NAME
parser.py is called with the following invocation, from bench_processing:
run_python $PYTHON_ARGS $FUEGO_CORE/$engine/tests/$TESTDIR/parser.py $JOB_NAME $PLATFORM $BUILD_ID $BUILD_NUMBER $FW $PLATFORM $NODE_NAME
SOURCE [edit section]
Located in /home/fuego/tests/<testname>/parser.py, which is the same as engine/tests/<testname>/parser.py.
SEE ALSO [edit section]