blob: f7e929747bac147f58efa2905137fb9f3bca836f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
#!/usr/bin/python
# 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).
# Import the modules we need. You should not need to know about
# their internals.
import trace_reader
import sanitizer
import gedf_test
import stats
import stdout_printer
# 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',
]
# 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.
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
# 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
|