Lines 11-17
import time
Link Here
|
11 |
|
11 |
|
12 |
# |
12 |
# |
13 |
# Check for requirements: |
13 |
# Check for requirements: |
14 |
# o Linux >= 2.6.20 with I/O accounting |
14 |
# o Linux >= 2.6.20 with I/O accounting and VM event counters |
15 |
# o Python >= 2.5 or Python 2.4 + ctypes |
15 |
# o Python >= 2.5 or Python 2.4 + ctypes |
16 |
# |
16 |
# |
17 |
|
17 |
|
Lines 22-37
except ImportError:
Link Here
|
22 |
has_ctypes = False |
22 |
has_ctypes = False |
23 |
else: |
23 |
else: |
24 |
has_ctypes = True |
24 |
has_ctypes = True |
|
|
25 |
try: |
26 |
from iotop.vmstat import VmStat |
27 |
vmstat_f = VmStat() |
28 |
except: |
29 |
vm_event_counters = False |
30 |
else: |
31 |
vm_event_counters = True |
25 |
|
32 |
|
26 |
if not ioaccounting or not has_ctypes: |
33 |
if not ioaccounting or not has_ctypes or not vm_event_counters: |
27 |
def boolean2string(boolean): |
|
|
28 |
return boolean and 'Found' or 'Not found' |
29 |
print 'Could not run iotop as some of the requirements are not met:' |
34 |
print 'Could not run iotop as some of the requirements are not met:' |
30 |
print '- Linux >= 2.6.20 with I/O accounting support ' \ |
35 |
if not ioaccounting or not vm_event_counters: |
31 |
'(CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, ' \ |
36 |
print '- Linux >= 2.6.20 with' |
32 |
'CONFIG_TASK_IO_ACCOUNTING):', boolean2string(ioaccounting) |
37 |
if not ioaccounting: |
33 |
print '- Python >= 2.5 or Python 2.4 with the ctypes module:', \ |
38 |
print ' - I/O accounting support ' \ |
34 |
boolean2string(has_ctypes) |
39 |
'(CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, ' \ |
|
|
40 |
'CONFIG_TASK_IO_ACCOUNTING)' |
41 |
if not vm_event_counters: |
42 |
print ' - VM event counters (CONFIG_VM_EVENT_COUNTERS)' |
43 |
if not has_ctypes: |
44 |
print '- Python >= 2.5 or Python 2.4 with the ctypes module' |
35 |
|
45 |
|
36 |
sys.exit(1) |
46 |
sys.exit(1) |
37 |
|
47 |
|
38 |
- |
|
|