This is long and potentially boring.
However I will share my adventure which may reveal some of the working of
vmstat.
I was throwing some heavy load at my snv_134 server and watching "vmstat
5" run. I saw this sort of output :
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr cd -- -- -- in sy cs us
sy id
3 0 0 765028 56244 608 151 6 0 0 0 0 115 0 0 0 677 6018 392 70
29 2
4 1 0 778740 56260 643 175 35 0 0 0 0 241 0 0 0 919 6639 541 73
27 0
4 0 0 779056 56492 692 329 10 1 1 0 0 14 0 0 0 464 6896 444 73
27 0
4 0 0 778784 56320 709 350 6 12 12 0 0 20 0 0 0 460 6649 363 73
27 0
3 0 0 764988 56248 698 354 7 6 6 0 0 16 0 0 0 467 6845 410 73
27 0
3 0 0 765068 56380 656 198 5 3 3 0 0 4 0 0 0 447 6672 399 76
24 0
4 0 0 764960 56256 654 203 3 0 0 0 0 21 0 0 0 477 6764 448 71
29 0
2 0 0 792428 56460 677 277 9 4 4 0 0 279 0 0 0 1009 8772 960 59
38 3
4 0 0 779012 56556 543 277 21 1 1 0 0 38 0 0 0 505 6263 579 69
31 0
3 0 0 765028 56324 707 284 7 0 0 0 0 57 0 0 0 528 7098 457 73
27 0
4 0 0 778888 56488 792 287 7 6 6 0 0 10 0 0 0 447 7699 402 74
26 0
3 0 0 778756 56400 680 284 6 0 0 0 0 10 0 0 0 449 6667 389 75
25 0
3 0 0 779072 56608 404 279 6 0 0 0 0 102 0 0 0 667 4399 481 69
30 1
4 0 0 765036 56248 278 35 56 1 1 0 0 217 0 0 0 992 4356 884 76
24 0
5 0 0 778848 55800 671 330 325 0 0 0 0 65 0 0 0 592 7698 740 67
33 0
6 1 0 776456 52040 347 1084 781 6 6 0 0 104 0 0 0 609 4536 735 61
39 0
3 0 0 770644 45548 469 227 6 2 2 0 0 20 0 0 0 513 5370 553 75
25 0
3 0 0 770364 45416 669 249 7 2 2 0 0 11 0 0 0 460 6909 419 74
26 0
3 0 0 756460 45292 621 97 2 2 2 0 0 82 0 0 0 615 6473 444 71
29 0
Let me repaste that with the double spaces squeezed out :
kthr memory page disk faults cpu
r b w swap free re mf pi po fr de sr cd -- -- -- in sy cs us sy id
3 0 0 765028 56244 608 151 6 0 0 0 0 115 0 0 0 677 6018 392 70 29 2
4 1 0 778740 56260 643 175 35 0 0 0 0 241 0 0 0 919 6639 541 73 27 0
4 0 0 779056 56492 692 329 10 1 1 0 0 14 0 0 0 464 6896 444 73 27 0
4 0 0 778784 56320 709 350 6 12 12 0 0 20 0 0 0 460 6649 363 73 27 0
3 0 0 764988 56248 698 354 7 6 6 0 0 16 0 0 0 467 6845 410 73 27 0
3 0 0 765068 56380 656 198 5 3 3 0 0 4 0 0 0 447 6672 399 76 24 0
4 0 0 764960 56256 654 203 3 0 0 0 0 21 0 0 0 477 6764 448 71 29 0
2 0 0 792428 56460 677 277 9 4 4 0 0 279 0 0 0 1009 8772 960 59 38 3
4 0 0 779012 56556 543 277 21 1 1 0 0 38 0 0 0 505 6263 579 69 31 0
3 0 0 765028 56324 707 284 7 0 0 0 0 57 0 0 0 528 7098 457 73 27 0
4 0 0 778888 56488 792 287 7 6 6 0 0 10 0 0 0 447 7699 402 74 26 0
3 0 0 778756 56400 680 284 6 0 0 0 0 10 0 0 0 449 6667 389 75 25 0
3 0 0 779072 56608 404 279 6 0 0 0 0 102 0 0 0 667 4399 481 69 30 1
4 0 0 765036 56248 278 35 56 1 1 0 0 217 0 0 0 992 4356 884 76 24 0
5 0 0 778848 55800 671 330 325 0 0 0 0 65 0 0 0 592 7698 740 67 33 0
6 1 0 776456 52040 347 1084 781 6 6 0 0 104 0 0 0 609 4536 735 61 39 0
3 0 0 770644 45548 469 227 6 2 2 0 0 20 0 0 0 513 5370 553 75 25 0
3 0 0 770364 45416 669 249 7 2 2 0 0 11 0 0 0 460 6909 419 74 26 0
3 0 0 756460 45292 621 97 2 2 2 0 0 82 0 0 0 615 6473 444 71 29 0
So we agree that the machine is busy. That is fine.
What is very odd is that I see under the "disk" columns this :
disk
cd -- -- --
115 0 0 0
241 0 0 0
14 0 0 0
20 0 0 0
16 0 0 0
4 0 0 0
21 0 0 0
279 0 0 0
38 0 0 0
57 0 0 0
10 0 0 0
10 0 0 0
102 0 0 0
217 0 0 0
65 0 0 0
104 0 0 0
20 0 0 0
11 0 0 0
82 0 0 0
The problem is that this machine does not have a cd or dvd. It says "cd"
there but I can not figure why.
I think that the issue is with the kstat data and not vmstat because in
usr/src/cmd/stat/vmstat/vmstat.c I see this :
static void
print_disk(void *v, void *v2, void *d)
{
struct iodev_snapshot *iodev = (struct iodev_snapshot *)v2;
if (iodev == NULL)
return;
(void) printf("%c%c ", iodev->is_name[0], iodev->is_name[2]);
}
The struct iodev_snapshot is in /usr/src/cmd/stat/common/statcommon.h thus
struct iodev_snapshot {
/* original kstat name */
char is_name[KSTAT_STRLEN];
/* type of kstat */
enum iodev_type is_type;
/* ID if meaningful */
struct iodev_id is_id;
/* parent ID if meaningful */
struct iodev_id is_parent_id;
/* user-friendly name if found */
char *is_pretty;
/* device ID if applicable */
char *is_devid;
/* mount-point if applicable */
char *is_dname;
/* number of direct children */
int is_nr_children;
/* children of this I/O device */
struct iodev_snapshot *is_children;
/* standard I/O stats */
kstat_io_t is_stats;
/* iodev error stats */
kstat_t is_errors;
/* creation time of the stats */
hrtime_t is_crtime;
/* time at which iodev snapshot was taken */
hrtime_t is_snaptime;
/* kstat module */
char is_module[KSTAT_STRLEN];
/* kstat instance */
int is_instance;
/* kstat (only used temporarily) */
kstat_t *is_ksp;
struct iodev_snapshot *is_prev;
struct iodev_snapshot *is_next;
/* AVL structures to speedup insertion */
avl_tree_t *avl_list; /* list this element belongs to */
avl_node_t avl_link;
};
It looks like vmstat is just printing out data from the char is_name[] and
that is where "cd" is coming from.
I compiled my own vmstat with full symbols and debug data in it :
$ ls -l *.o vmstat
-rw-r--r-- 1 dclarke csw 27852 Mar 7 02:59 acquire.o
-rw-r--r-- 1 dclarke csw 41856 Mar 7 02:59 acquire_iodevs.o
-rw-r--r-- 1 dclarke csw 7088 Mar 7 02:59 common.o
-rw-r--r-- 1 dclarke csw 29348 Mar 7 02:59 dsr.o
-rw-r--r-- 1 dclarke csw 10864 Mar 7 02:59 mnt.o
-rw-r--r-- 1 dclarke csw 4844 Mar 7 02:59 timestamp.o
-rwxr-xr-x 1 dclarke csw 165492 Mar 7 02:59 vmstat
-rw-r--r-- 1 dclarke csw 46872 Mar 7 02:59 vmstat.o
-rw-r--r-- 1 dclarke csw 21856 Mar 7 02:59 walkers.o
I then stuffed this in :
static void
print_disk(void *v, void *v2, void *d)
{
struct iodev_snapshot *iodev = (struct iodev_snapshot *)v2;
if (iodev == NULL)
return;
(void) printf("%c%c ", iodev->is_name[0], iodev->is_name[2]);
/* very hacky but this should work */
(void) fprintf ( stderr, "\n%s\n", iodev->is_name );
}
recompile and run and le voilĂ :
$ ./vmstat 5
kthr memory page disk faults cpu
cmdk0
r b w swap free re mf pi po fr de sr cd -- -- -- in sy cs us
sy id
0 0 0 918908 128920 21 30 7 3 3 0 1 5 0 0 0 627 909 520 28
12 60
0 0 0 852296 74920 3 7 0 0 0 0 0 0 0 0 0 628 725 469 22
8 71
0 0 0 852296 75444 0 0 0 0 0 0 0 0 0 0 0 638 698 471 21
8 72
I guess I could have found that out with iostat :
$ iostat -xtc 5
extended device statistics tty
cpu
device r/s w/s kr/s kw/s wait actv svc_t %w %b tin tout us
sy wt id
cmdk0 1.1 3.7 7.5 24.7 0.0 0.0 12.5 0 1 1 89 28
12 0 60
extended device statistics tty
cpu
device r/s w/s kr/s kw/s wait actv svc_t %w %b tin tout us
sy wt id
cmdk0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0 0 0 65 21
8 0 71
So why does vmstat use, for totally obscure reasons, char[0] and char[2]
of iodev->is_name and not something else ?
Also .. just a note, the libavl symlinks are missing in /usr/lib and I had
to mess around a bit to compile vmstat.
Also some headers are missing on snv_134 and I have to go into the
onnv-gate to get these :
#include <sys/scsi/adapters/mpapi_impl.h>
#include <sys/scsi/adapters/mpapi_scsi_vhci.h>
So anyways .. why iodev->is_name[0] and iodev->is_name[2] which looks a
lot like "cd" on a machine with no CD/DVD ??
--
Dennis Clarke
[email protected] <- Email related to the open source Solaris
[email protected] <- Email related to open source for Solaris
_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code