tags 574346 + patch
thanks

On Thu, 2010-03-18 at 20:53 +0700, Paul Wise wrote:

> Guillaume, how would you suggest this be fixed? Should iotop check for
> the required parameters in /proc/vmstat at the top of iotop/data.py like
> it does for /proc/self/io or should it handle exceptions from VmStat
> gracefully?

Guillaume, here is a patch for this issue, it documents the requirement
for CONFIG_VM_EVENT_COUNTER and checks for it at startup. It is to be
applied on top of the other patch I sent you.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise
From 5dbf2d4e8263987db272e6b208323f3788788613 Mon Sep 17 00:00:00 2001
From: Paul Wise <pa...@bonedaddy.net>
Date: Mon, 31 May 2010 16:42:06 +0800
Subject: [PATCH 2/2] 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 36c3b0d..3cf5c55 100644
--- a/iotop/data.py
+++ b/iotop/data.py
@@ -11,7 +11,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
 #
 
@@ -22,13 +22,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'
 
-- 
1.7.1

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to