From 456fbed70e1c7ab467527e23270e600e1739bc49 Mon Sep 17 00:00:00 2001 From: Paul Wise Date: Mon, 31 May 2010 16:42:06 +0800 Subject: [PATCH] Document the requirement for CONFIG_VM_EVENT_COUNTERS and check for it on startup. Closes: http://bugs.debian.org/574346 --- README | 4 ++-- iotop.1 | 6 +++--- iotop/data.py | 19 +++++++++++++++---- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/README b/README index 9be097c..43e1458 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ Iotop is a Python program with a top like UI used to show of behalf of which process is the I/O going on. It requires Python >= 2.5 (or Python >= 2.4 with -the ctypes module) and a Linux kernel >= 2.6.20 with the TASK_DELAY_ACCT and -TASK_IO_ACCOUNTING options enabled. +the ctypes module) and a Linux kernel >= 2.6.20 with the TASK_DELAY_ACCT +CONFIG_TASKSTATS, TASK_IO_ACCOUNTING and CONFIG_VM_EVENT_COUNTERS options on. To run a local version of iotop: diff --git a/iotop.1 b/iotop.1 index e881008..4d69348 100644 --- a/iotop.1 +++ b/iotop.1 @@ -8,9 +8,9 @@ iotop \- simple top\-like I/O monitor .SH DESCRIPTION iotop watches I/O usage information output by the Linux kernel (requires 2.6.20 or later) and displays a table of current I/O usage by processes -or threads on the system. At least the CONFIG_TASK_DELAY_ACCT and -CONFIG_TASK_IO_ACCOUNTING options need to be enabled in your Linux kernel -build configuration, these options depend on CONFIG_TASKSTATS. +or threads on the system. At least the CONFIG_TASK_DELAY_ACCT, +CONFIG_TASK_IO_ACCOUNTING, CONFIG_TASKSTATS and CONFIG_VM_EVENT_COUNTERS +options need to be enabled in your Linux kernel build configuration. .PP iotop displays columns for the I/O bandwidth read and written by each process/thread during the sampling period. It also displays the percentage diff --git a/iotop/data.py b/iotop/data.py index a55a2bf..d82c807 100644 --- a/iotop/data.py +++ b/iotop/data.py @@ -29,7 +29,7 @@ import time # # Check for requirements: -# o Linux >= 2.6.20 with I/O accounting +# o Linux >= 2.6.20 with I/O accounting and VM event counters # o Python >= 2.5 or Python 2.4 + ctypes # @@ -40,13 +40,24 @@ except ImportError: has_ctypes = False else: has_ctypes = True +try: + from iotop.vmstat import VmStat + vmstat_f = VmStat() +except: + vm_event_counters = False +else: + vm_event_counters = True -if not ioaccounting or not has_ctypes: +if not ioaccounting or not has_ctypes or not vm_event_counters: print 'Could not run iotop as some of the requirements are not met:' - if not ioaccounting: - print '- Linux >= 2.6.20 with I/O accounting support ' \ + if not ioaccounting or not vm_event_counters: + 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)' if not has_ctypes: print '- Python >= 2.5 or Python 2.4 with the ctypes module' -- 2.11.4.GIT