From beab41dc5f360324549fd14b3daa8fce613e66ff Mon Sep 17 00:00:00 2001 From: Mac Mollison Date: Sat, 13 Mar 2010 16:44:30 -0500 Subject: Updates included frontend scripts to match doc --- sample_script.py | 65 ---------------------------------------------------- scripts/gedf_test.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/visualize.py | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 128 insertions(+), 65 deletions(-) delete mode 100755 sample_script.py create mode 100755 scripts/gedf_test.py create mode 100755 scripts/visualize.py diff --git a/sample_script.py b/sample_script.py deleted file mode 100755 index a5fed86..0000000 --- a/sample_script.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/python - -################################################################################ -# Description -################################################################################ -# This is a sample script for using the tool. I would recommend copying -# this and modifying it to suit your needs for a particular test. Make -# sure you redirect the output to a file (e.g. ./sample_script.py > output). - -################################################################################ -# Setup -################################################################################ - -# Import the modules we need. You should not need to know about -# their internals. -import unit_trace -from unit_trace import trace_reader -from unit_trace import sanitizer -from unit_trace import gedf_test -from unit_trace import stats -from unit_trace import stdout_printer -from unit_trace import visualizer - -# Specify your trace files -g6 = [ -'./sample_traces/st-g6-0.bin', -'./sample_traces/st-g6-1.bin', -'./sample_traces/st-g6-2.bin', -'./sample_traces/st-g6-3.bin', -] - -################################################################################ -# Pipeline -################################################################################ - -# Read events from traces -stream = trace_reader.trace_reader(g6) - -# Filter out garbage events -stream = sanitizer.sanitizer(stream) - -# Produce G-EDF error records -stream = gedf_test.gedf_test(stream) - -# Produce a statistics record -stream = stats.stats(stream) - -# Filter some records out -# NOTE: Currently, this will break the Visualizer if enabled -def my_filter(record): - if record.record_type == 'error' and record.type_name == 'inversion_end': - if record.job.inversion_end - record.job.inversion_start < 4000000: - return False - return True -#stream = filter(my_filter, stream) - -# Split the stream in two, so we can use both output mechanisms -import itertools -stream1, stream2 = itertools.tee(stream,2) - -# Print the records to stdout -stdout_printer.stdout_printer(stream1) - -# Visualize the records -visualizer.visualizer(stream2) diff --git a/scripts/gedf_test.py b/scripts/gedf_test.py new file mode 100755 index 0000000..385f424 --- /dev/null +++ b/scripts/gedf_test.py @@ -0,0 +1,64 @@ +#!/usr/bin/python + +################################################################################ +# Description +################################################################################ +# This script performs a G-EDF test and outputs the results to std out. + +# This script should be invoked with the names of the trace files you want to +# use. For example, `gedf_test.py ../sample_traces/*.bin`. +# You probably want to redirect the (normally lengthy) output to a file! +# Otherwise, speed is greatly decreased b/c terminal printing is slow. + +################################################################################ +# Setup +################################################################################ + +# Import the modules we need. You should not need to know about +# their internals. +import unit_trace +from unit_trace import trace_reader +from unit_trace import sanitizer +from unit_trace import gedf_test +from unit_trace import stats +from unit_trace import stdout_printer +from unit_trace import visualizer + +# Get trace files from command line arguments +from optparse import OptionParser +parser = OptionParser() +(options, traces) = parser.parse_args() +traces = list(traces) + +################################################################################ +# Pipeline +################################################################################ + +# Read events from traces +stream = trace_reader.trace_reader(traces) + +# Filter out garbage events +stream = sanitizer.sanitizer(stream) + +# Produce G-EDF error records +stream = gedf_test.gedf_test(stream) + +# Produce a statistics record +stream = stats.stats(stream) + +# Filter some records out +def my_filter(record): + if record.record_type == 'error' and record.type_name == 'inversion_end': + if record.job.inversion_end - record.job.inversion_start < 4000000: + return False + return True +#stream = filter(my_filter, stream) + +# It is possible to split the stream in two, +# so we can use more than one output mechanism (for example) +# without re-doing earlier work. +# import itertools +# stream1, stream2 = itertools.tee(stream,2) + +# Print the records to stdout +stdout_printer.stdout_printer(stream) diff --git a/scripts/visualize.py b/scripts/visualize.py new file mode 100755 index 0000000..2b828be --- /dev/null +++ b/scripts/visualize.py @@ -0,0 +1,64 @@ +#!/usr/bin/python + +################################################################################ +# Description +################################################################################ +# This scriipt demonstrates the visualizer submodule. + +# This script should be invoked with the names of the trace files you want to +# use. For example, `gedf_test.py ../sample_traces/*.bin`. +# You probably want to redirect the (normally lengthy) output to a file! +# Otherwise, speed is greatly decreased b/c terminal printing is slow. + +################################################################################ +# Setup +################################################################################ + +# Import the modules we need. You should not need to know about +# their internals. +import unit_trace +from unit_trace import trace_reader +from unit_trace import sanitizer +from unit_trace import gedf_test +from unit_trace import stats +from unit_trace import stdout_printer +from unit_trace import visualizer + +# Get trace files from command line arguments +from optparse import OptionParser +parser = OptionParser() +(options, traces) = parser.parse_args() +traces = list(traces) + +################################################################################ +# Pipeline +################################################################################ + +# Read events from traces +stream = trace_reader.trace_reader(traces) + +# Filter out garbage events +stream = sanitizer.sanitizer(stream) + +# Produce G-EDF error records +stream = gedf_test.gedf_test(stream) + +# Produce a statistics record +stream = stats.stats(stream) + +# Filter some records out +def my_filter(record): + if record.record_type == 'error' and record.type_name == 'inversion_end': + if record.job.inversion_end - record.job.inversion_start < 4000000: + return False + return True +#stream = filter(my_filter, stream) + +# It is possible to split the stream in two, +# so we can use more than one output mechanism (for example) +# without re-doing earlier work. +# import itertools +# stream1, stream2 = itertools.tee(stream,2) + +# Print the records to stdout +visualizer.visualizer(stream) -- cgit v1.2.2