Bug#379764: sysstat: iostat fails to show stats of one partition

2006-07-26 Thread Sebastien Godard

Hi,

Toni Timonen wrote:

Package: sysstat
Version: 6.1.3-1
Severity: normal
Tags: patch

getting iostat of one partition fails.
eg.


[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3$ ./iostat -p /dev/hda1
Linux 2.6.15-1-686 (sd033)  25/07/06

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
  10.860.64   35.550.720.00   52.23

  Device:tps   Blk_read/s   Blk_wrtn/s   Blk_read 
Blk_wrtn
[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3$

(but running 'iostat -p /dev/hda' gives full output).
A patch to fix this issue is attached.



No, this is not the expected behavior for iostat.
The argument following option -p should be a device (like /dev/hda, 
/dev/sda, etc.), and not a partition (/dev/hda1, ...).
iostat -p /dev/hda tells iostat to display the statistics for device 
hda and all its partitions.
If you want to display the stats only for hda1, just enter iostat 
/dev/hda1 (and not iostat -p /dev/hda1).


Regards,
--
Sebastien GODARD (sysstat maintainer)
http://perso.orange.fr/sebastien.godard/


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]



Bug#379764: sysstat: iostat fails to show stats of one partition

2006-07-25 Thread Toni Timonen
Package: sysstat
Version: 6.1.3-1
Severity: normal
Tags: patch

Hi,

getting iostat of one partition fails.
eg.


[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3$ ./iostat -p /dev/hda1
Linux 2.6.15-1-686 (sd033)  25/07/06

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
  10.860.64   35.550.720.00   52.23

  Device:tps   Blk_read/s   Blk_wrtn/s   Blk_read 
Blk_wrtn
[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3$


(but running 'iostat -p /dev/hda' gives full output).
A patch to fix this issue is attached.

Behaviour after the patch:

[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3-patched$ ./iostat -p /dev/hda1
Linux 2.6.15-1-686 (sd033)  07/25/06

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
  10.860.64   35.550.720.00   52.23

Device:tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
hda1  0.00 0.00 0.00   7993   9460

[EMAIL PROTECTED]:~/work/m/tmp/sysstat-6.1.3-patched$ 


-- 
Toni Timonen
040-5111863,GPG 0x7984A4FD
--- sysstat-6.1.3/iostat.c  2006-05-24 16:24:07.0 +0300
+++ sysstat-6.1.3-patched/iostat.c  2006-07-25 15:14:22.0 +0300
@@ -577,6 +577,17 @@
   if (ok  st_dev_list_i-disp_part)
 /* Also read stats for its partitions */
 read_sysfs_dlist_part_stat(curr, st_dev_list_i-dev_name);
+  else {
+   char *parent=strdup(st_dev_list_i-dev_name);
+   char *p=strpbrk(parent,DIGITS);
+   if(p) {
+   *p=0;
+   sprintf(filename,%s/%s/%s/%s,
+   SYSFS_BLOCK,parent,st_dev_list_i-dev_name,S_STAT);
+   
read_sysfs_file_stat(curr,filename,st_dev_list_i-dev_name,DT_PARTITION);
+   }
+   free(parent);
+  }
}
 
/* Free structures corresponding to unregistered devices */