From 14a40b99735f09f6e70b8e897acbb622f9115ca3 Mon Sep 17 00:00:00 2001 From: Mac Mollison Date: Sat, 13 Mar 2010 12:09:00 -0500 Subject: Directory restructuring Reworked directory (and modified some code a bit) to match intended architecture. --- sample_script.py | 49 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 36 insertions(+), 13 deletions(-) (limited to 'sample_script.py') diff --git a/sample_script.py b/sample_script.py index c3b7843..435cde0 100755 --- a/sample_script.py +++ b/sample_script.py @@ -1,9 +1,16 @@ #!/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 trace_reader @@ -11,6 +18,7 @@ import sanitizer import gedf_test import stats import stdout_printer +import visualizer # Specify your trace files g6 = [ @@ -20,22 +28,37 @@ g6 = [ './sample_traces/st-g6-3.bin', ] -# Here is an example of a custom filter function. -# It will remove from the error stream all inversion_end records indicating -# an inversion of less than 4000000 time units. Thus, you can grep through -# the output looking 'Inversion end' and find only errors for particularly -# long inversions. This is commented out in the pipeline (below) since you -# probably don't want it in general. +################################################################################ +# 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) -# Pipeline -stream = trace_reader.trace_reader(g6) # Read events from traces -stream = sanitizer.sanitizer(stream) # Remove garbage events -stream = gedf_test.gedf_test(stream) # Produce G-EDF error records -stream = stats.stats(stream) # Produce a statistics record -#stream = filter(my_filter, stream) # Filter some records before printing -stdout_printer.stdout_printer(stream) # Print records to stdout +# 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) -- cgit v1.2.2