diff options
| author | Gary Bressler <garybressler@nc.rr.com> | 2010-03-01 23:46:44 -0500 |
|---|---|---|
| committer | Gary Bressler <garybressler@nc.rr.com> | 2010-03-01 23:46:44 -0500 |
| commit | 44a8ade3ed5dc4810fd95c41dbe8ec3aa2fb0cf7 (patch) | |
| tree | 4275bbcb03ec58412c3703e4df68f43fb1c10089 /reader/sample_script.py | |
Reorganized tree, along with the visualizer
Diffstat (limited to 'reader/sample_script.py')
| -rwxr-xr-x | reader/sample_script.py | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/reader/sample_script.py b/reader/sample_script.py new file mode 100755 index 0000000..f7e9297 --- /dev/null +++ b/reader/sample_script.py | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | #!/usr/bin/python | ||
| 2 | |||
| 3 | # This is a sample script for using the tool. I would recommend copying | ||
| 4 | # this and modifying it to suit your needs for a particular test. Make | ||
| 5 | # sure you redirect the output to a file (e.g. ./sample_script.py > output). | ||
| 6 | |||
| 7 | # Import the modules we need. You should not need to know about | ||
| 8 | # their internals. | ||
| 9 | import trace_reader | ||
| 10 | import sanitizer | ||
| 11 | import gedf_test | ||
| 12 | import stats | ||
| 13 | import stdout_printer | ||
| 14 | |||
| 15 | # Specify your trace files | ||
| 16 | g6 = [ | ||
| 17 | '../sample_traces/st-g6-0.bin', | ||
| 18 | '../sample_traces/st-g6-1.bin', | ||
| 19 | '../sample_traces/st-g6-2.bin', | ||
| 20 | '../sample_traces/st-g6-3.bin', | ||
| 21 | ] | ||
| 22 | |||
| 23 | # Here is an example of a custom filter function. | ||
| 24 | # It will remove from the error stream all inversion_end records indicating | ||
| 25 | # an inversion of less than 4000000 time units. Thus, you can grep through | ||
| 26 | # the output looking 'Inversion end' and find only errors for particularly | ||
| 27 | # long inversions. This is commented out in the pipeline (below) since you | ||
| 28 | # probably don't want it in general. | ||
| 29 | def my_filter(record): | ||
| 30 | if record.record_type == 'error' and record.type_name == 'inversion_end': | ||
| 31 | if record.job.inversion_end - record.job.inversion_start < 4000000: | ||
| 32 | return False | ||
| 33 | return True | ||
| 34 | |||
| 35 | # Pipeline | ||
| 36 | stream = trace_reader.trace_reader(g6) # Read events from traces | ||
| 37 | stream = sanitizer.sanitizer(stream) # Remove garbage events | ||
| 38 | stream = gedf_test.gedf_test(stream) # Produce G-EDF error records | ||
| 39 | stream = stats.stats(stream) # Produce a statistics record | ||
| 40 | #stream = filter(my_filter, stream) # Filter some records before printing | ||
| 41 | stdout_printer.stdout_printer(stream) # Print records to stdout | ||
