diff options
| author | Mac Mollison <mollison@cs.unc.edu> | 2010-03-14 03:17:40 -0400 |
|---|---|---|
| committer | Mac Mollison <mollison@cs.unc.edu> | 2010-03-14 03:17:40 -0400 |
| commit | 361d978921690a7c26a63b933b502d5d2fc3e3d5 (patch) | |
| tree | 851173b45f26ee94a10065e2efeac3ca0d7bcde7 /scripts | |
| parent | 17977f3e1a454efe197650b34365af15a63f4afe (diff) | |
Refactor to get rid of various frontend scripts
Now, unit-trace.py can control all functionality.
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/gedf_test.py | 73 | ||||
| -rwxr-xr-x | scripts/unit-trace.py | 100 | ||||
| -rwxr-xr-x | scripts/visualize.py | 52 |
3 files changed, 0 insertions, 225 deletions
diff --git a/scripts/gedf_test.py b/scripts/gedf_test.py deleted file mode 100755 index 2f67bc0..0000000 --- a/scripts/gedf_test.py +++ /dev/null | |||
| @@ -1,73 +0,0 @@ | |||
| 1 | #!/usr/bin/python | ||
| 2 | |||
| 3 | ################################################################################ | ||
| 4 | # Description | ||
| 5 | ################################################################################ | ||
| 6 | # This script performs a G-EDF test and outputs the results to std out. | ||
| 7 | |||
| 8 | # This script should be invoked with the names of the trace files you want to | ||
| 9 | # use. For example, `gedf_test.py ../sample_traces/*.bin`. | ||
| 10 | # You probably want to redirect the (normally lengthy) output to a file! | ||
| 11 | # Otherwise, speed is greatly decreased b/c terminal printing is slow. | ||
| 12 | |||
| 13 | ################################################################################ | ||
| 14 | # Setup | ||
| 15 | ################################################################################ | ||
| 16 | |||
| 17 | # Import the modules we need. You should not need to know about | ||
| 18 | # their internals. | ||
| 19 | import unit_trace | ||
| 20 | from unit_trace import trace_reader | ||
| 21 | from unit_trace import sanitizer | ||
| 22 | from unit_trace import gedf_test | ||
| 23 | from unit_trace import stats | ||
| 24 | from unit_trace import stdout_printer | ||
| 25 | from unit_trace import visualizer | ||
| 26 | from unit_trace import progress | ||
| 27 | |||
| 28 | # Get trace files from command line arguments | ||
| 29 | from optparse import OptionParser | ||
| 30 | usage = "usage: %prog <one or more trace files>" | ||
| 31 | parser = OptionParser(usage=usage) | ||
| 32 | (options, traces) = parser.parse_args() | ||
| 33 | traces = list(traces) | ||
| 34 | if len(traces) < 1: | ||
| 35 | parser.print_help() | ||
| 36 | exit() | ||
| 37 | |||
| 38 | ################################################################################ | ||
| 39 | # Pipeline | ||
| 40 | ################################################################################ | ||
| 41 | |||
| 42 | # Read events from traces | ||
| 43 | stream = trace_reader.trace_reader(traces) | ||
| 44 | |||
| 45 | # Filter out garbage events | ||
| 46 | stream = sanitizer.sanitizer(stream) | ||
| 47 | |||
| 48 | # Display progress information using stderr | ||
| 49 | # e.g. # records completed so far, total time, etc. | ||
| 50 | stream = progress.progress(stream) | ||
| 51 | |||
| 52 | # Produce G-EDF error records | ||
| 53 | stream = gedf_test.gedf_test(stream) | ||
| 54 | |||
| 55 | # Produce a statistics record | ||
| 56 | stream = stats.stats(stream) | ||
| 57 | |||
| 58 | # Filter some records out | ||
| 59 | def my_filter(record): | ||
| 60 | if record.record_type == 'error' and record.type_name == 'inversion_end': | ||
| 61 | if record.job.inversion_end - record.job.inversion_start < 4000000: | ||
| 62 | return False | ||
| 63 | return True | ||
| 64 | #stream = filter(my_filter, stream) | ||
| 65 | |||
| 66 | # It is possible to split the stream in two, | ||
| 67 | # so we can use more than one output mechanism (for example) | ||
| 68 | # without re-doing earlier work. | ||
| 69 | # import itertools | ||
| 70 | # stream1, stream2 = itertools.tee(stream,2) | ||
| 71 | |||
| 72 | # Print the records to stdout | ||
| 73 | stdout_printer.stdout_printer(stream) | ||
diff --git a/scripts/unit-trace.py b/scripts/unit-trace.py deleted file mode 100755 index 5d772e8..0000000 --- a/scripts/unit-trace.py +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | #!/usr/bin/python | ||
| 2 | |||
| 3 | ################################################################################ | ||
| 4 | # Description | ||
| 5 | ################################################################################ | ||
| 6 | # Control script for unit-trace | ||
| 7 | |||
| 8 | ################################################################################ | ||
| 9 | # Setup | ||
| 10 | ################################################################################ | ||
| 11 | |||
| 12 | # Import the modules we need. You should not need to know about | ||
| 13 | # their internals. | ||
| 14 | import unit_trace | ||
| 15 | from unit_trace import trace_reader | ||
| 16 | from unit_trace import sanitizer | ||
| 17 | from unit_trace import gedf_test | ||
| 18 | from unit_trace import stats | ||
| 19 | from unit_trace import stdout_printer | ||
| 20 | from unit_trace import visualizer | ||
| 21 | from unit_trace import progress | ||
| 22 | from unit_trace import skipper | ||
| 23 | from unit_trace import maxer | ||
| 24 | |||
| 25 | # Get trace files from command line arguments | ||
| 26 | from optparse import OptionParser | ||
| 27 | usage = "usage: %prog [options] <one or more trace files>" | ||
| 28 | parser = OptionParser(usage=usage) | ||
| 29 | parser.add_option("-s", "--skip", dest="skipnum", default=0, type=int, | ||
| 30 | help="Skip over a fixed number of records") | ||
| 31 | parser.add_option("-m", "--max", dest="maxnum", default=0, type=int, | ||
| 32 | help="Maximum number of records to parse") | ||
| 33 | parser.add_option("-p", "--progress", action="store_true", dest="progress", | ||
| 34 | default=False, help="Show parsing progress") | ||
| 35 | parser.add_option("-g", "--gedf", action="store_true", dest="gedf", | ||
| 36 | default=False, help="Run G-EDF test") | ||
| 37 | parser.add_option("-i", "--info", action="store_true", dest="info", | ||
| 38 | default=False, help="Show statistical info") | ||
| 39 | parser.add_option("-o", "--stdout", action="store_true", dest="stdout", | ||
| 40 | default=False, help="Use stdout_printer") | ||
| 41 | parser.add_option("-v", "--visual", action="store_true", dest="visualize", | ||
| 42 | default=False, help="Use visualizer") | ||
| 43 | parser.add_option("-c", "--clean", action="store_true", dest="clean", | ||
| 44 | default=False, help="Use sanitizer to clean garbage records") | ||
| 45 | (options, traces) = parser.parse_args() | ||
| 46 | traces = list(traces) | ||
| 47 | if len(traces) < 1: | ||
| 48 | parser.print_help() | ||
| 49 | exit() | ||
| 50 | |||
| 51 | ################################################################################ | ||
| 52 | # Pipeline | ||
| 53 | ################################################################################ | ||
| 54 | |||
| 55 | # Read events from traces | ||
| 56 | stream = trace_reader.trace_reader(traces) | ||
| 57 | |||
| 58 | # Skip over records | ||
| 59 | if options.skipnum > 0: | ||
| 60 | stream = skipper.skipper(stream, options.skipnum) | ||
| 61 | |||
| 62 | # Enforce max number of records to parse | ||
| 63 | if options.maxnum > 0: | ||
| 64 | stream = maxer.maxer(stream, options.maxnum) | ||
| 65 | |||
| 66 | # Filter out garbage events | ||
| 67 | if options.clean is True: | ||
| 68 | stream = sanitizer.sanitizer(stream) | ||
| 69 | |||
| 70 | # Display progress information using stderr | ||
| 71 | # e.g. # records completed so far, total time, etc. | ||
| 72 | if options.progress is True: | ||
| 73 | stream = progress.progress(stream) | ||
| 74 | |||
| 75 | # Produce G-EDF error records | ||
| 76 | if options.gedf is True: | ||
| 77 | stream = gedf_test.gedf_test(stream) | ||
| 78 | |||
| 79 | # Produce a statistics record | ||
| 80 | if options.info is True: | ||
| 81 | stream = stats.stats(stream) | ||
| 82 | |||
| 83 | # Filter some records out | ||
| 84 | #def my_filter(record): | ||
| 85 | # if record.record_type == 'error' and record.type_name == 'inversion_end': | ||
| 86 | # if record.job.inversion_end - record.job.inversion_start < 4000000: | ||
| 87 | # return False | ||
| 88 | # return True | ||
| 89 | #stream = filter(my_filter, stream) | ||
| 90 | |||
| 91 | # Output | ||
| 92 | if options.stdout is True and options.visualize is True: | ||
| 93 | import itertools | ||
| 94 | stream1, stream2 = itertools.tee(stream,2) | ||
| 95 | stdout_printer.stdout_printer(stream1) | ||
| 96 | visualizer.visualizer(stream2) | ||
| 97 | elif options.stdout is True: | ||
| 98 | stdout_printer.stdout_printer(stream) | ||
| 99 | elif options.visualize is True: | ||
| 100 | visualizer.visualizer(stream) | ||
diff --git a/scripts/visualize.py b/scripts/visualize.py deleted file mode 100755 index 2899b43..0000000 --- a/scripts/visualize.py +++ /dev/null | |||
| @@ -1,52 +0,0 @@ | |||
| 1 | #!/usr/bin/python | ||
| 2 | |||
| 3 | ################################################################################ | ||
| 4 | # Description | ||
| 5 | ################################################################################ | ||
| 6 | # This scriipt demonstrates the visualizer submodule. | ||
| 7 | |||
| 8 | # This script should be invoked with the names of the trace files you want to | ||
| 9 | # use. For example, `gedf_test.py ../sample_traces/*.bin`. | ||
| 10 | # You probably want to redirect the (normally lengthy) output to a file! | ||
| 11 | # Otherwise, speed is greatly decreased b/c terminal printing is slow. | ||
| 12 | |||
| 13 | ################################################################################ | ||
| 14 | # Setup | ||
| 15 | ################################################################################ | ||
| 16 | |||
| 17 | # Import the modules we need. You should not need to know about | ||
| 18 | # their internals. | ||
| 19 | import unit_trace | ||
| 20 | from unit_trace import trace_reader | ||
| 21 | from unit_trace import sanitizer | ||
| 22 | from unit_trace import gedf_test | ||
| 23 | from unit_trace import stats | ||
| 24 | from unit_trace import stdout_printer | ||
| 25 | from unit_trace import visualizer | ||
| 26 | |||
| 27 | # Get trace files from command line arguments | ||
| 28 | from optparse import OptionParser | ||
| 29 | usage = "usage: %prog <one or more trace files>" | ||
| 30 | parser = OptionParser(usage=usage) | ||
| 31 | (options, traces) = parser.parse_args() | ||
| 32 | traces = list(traces) | ||
| 33 | if len(traces) < 1: | ||
| 34 | parser.print_help() | ||
| 35 | exit() | ||
| 36 | |||
| 37 | ################################################################################ | ||
| 38 | # Pipeline | ||
| 39 | ################################################################################ | ||
| 40 | |||
| 41 | # Read events from traces | ||
| 42 | stream = trace_reader.trace_reader(traces) | ||
| 43 | |||
| 44 | # Filter out garbage events | ||
| 45 | stream = sanitizer.sanitizer(stream) | ||
| 46 | |||
| 47 | # Note: You could include other submodules, to further modify | ||
| 48 | # the event stream (e.g. produce G-EDF error records that could be | ||
| 49 | # drawn by the visuazlier in future versions). | ||
| 50 | |||
| 51 | # Print the records to stdout | ||
| 52 | visualizer.visualizer(stream) | ||
