1 from .command
import Command
2 import lttnganalyses
.iotop
8 _DESC
= """The iotop command blabla bla.
9 It also does this and that."""
12 super().__init
__(self
._add
_arguments
, True)
14 def _validate_transform_args(self
):
16 self
._arg
_split
_count
= None
17 self
._arg
_split
= self
._args
.split
19 # split count if splitting?
21 if self
._args
.split_count
is None:
22 self
._cmdline
_error
('you must specify --split-count '
25 self
._arg
_split
_count
= self
._args
.split_count
28 self
._arg
_path
= self
._args
.path
31 # parse arguments first
34 # validate, transform and save specific arguments
35 self
._validate
_transform
_args
()
37 # everything processed at this point
38 print('begin: {}'.format(self
._arg
_begin
))
39 print('end: {}'.format(self
._arg
_end
))
40 print('uuu: {}'.format(self
._arg
_uuu))
41 print('split: {}'.format(self
._arg
_split
))
42 print('split-count: {}'.format(self
._arg
_split
_count
))
43 print('path: {}'.format(self
._arg
_path
))
46 # create the appropriate analysis/analyses
47 self
._create
_analysis
()
55 def _create_analysis(self
):
56 self
._analysis
= lttnganalyses
.iotop
.Iotop(self
._automaton
.state
,
58 self
._arg
_split
_count
)
60 def _run_analysis(self
):
64 self
.cond
= bool(random
.getrandbits(1))
68 for i
in range(random
.randint(5000, 10000)):
72 self
._automaton
.process_event(ev
)
75 self
._analysis
.process_event(ev
)
77 def _print_results(self
):
78 print('event count: {}'.format(self
._analysis
.event_count
))
81 for index
, count
in enumerate(self
._analysis
.buckets
):
82 print(' {:04d}: {}'.format(index
, count
))
84 def _add_arguments(self
, ap
):
86 ap
.add_argument('-s', '--split', action
='store_true', help='split')
87 ap
.add_argument('-c', '--split-count', type=int, help='split count')
89 # could be a common argument too
90 ap
.add_argument('path', help='trace path')
This page took 0.032968 seconds and 5 git commands to generate.