Created
February 11, 2013 15:38
-
-
Save mapk0y/4755175 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Check for requirements: | |
# o Linux >= 2.6.20 with I/O accounting and VM event counters | |
# | |
ioaccounting = os.path.exists('/proc/self/io') | |
try: | |
from iotop.vmstat import VmStat | |
vmstat_f = VmStat() | |
except: | |
vm_event_counters = False | |
else: | |
vm_event_counters = True | |
if not ioaccounting or not vm_event_counters: | |
print('Could not run iotop as some of the requirements are not met:') | |
print('- Linux >= 2.6.20 with') | |
if not ioaccounting: | |
print(' - I/O accounting support ' \ | |
'(CONFIG_TASKSTATS, CONFIG_TASK_DELAY_ACCT, ' \ | |
'CONFIG_TASK_IO_ACCOUNTING)') | |
if not vm_event_counters: | |
print(' - VM event counters (CONFIG_VM_EVENT_COUNTERS)') | |
sys.exit(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment