Skip to content

Instantly share code, notes, and snippets.

@mapk0y
Created February 11, 2013 15:38
Show Gist options
  • Save mapk0y/4755175 to your computer and use it in GitHub Desktop.
Save mapk0y/4755175 to your computer and use it in GitHub Desktop.
#
# 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