[Orca-checkins] r395 - trunk/orca/data_gatherers/orcallator
dmberezin at hotmail.com
dmberezin at hotmail.com
Tue Oct 5 08:21:48 PDT 2004
Author: dmberezin at hotmail.com
Date: Tue Oct 5 08:18:50 2004
New Revision: 395
Modified:
trunk/orca/data_gatherers/orcallator/orcallator.se
Log:
More changes to disk/tape data collection
* data_gatherers/orcallator/orcallator.se
Add check: define USE_KSTAT_IO only if NO_KSTAT_IO is not defined. This
allows disabling KSTAT_IO code with command line option.
Separate disk and tape statistics gathering. Add
define WATCH_TAPE
function measure_tape
We can only gather tape performance data with KSTAT_IO code at this time,
because of the way live_rules.se checks for disk slices to ignore them. It
simply checks if there is an 's' in the long_name, which is true for st
devices, so they are ignored. We could fix live_rules.se or combine
diskinfo.se and tapeinfo.se together to have correct long_name (rmt/xx)
appear when live_rules.se accesses it, but perhaps using KSTAT_IO for this
is sufficient.
(measure_disk): remove tape data gathering code - move to measure_tape.
(io_dev_info_t): add string dev_class to make it easier to identify type of
devices in measure_disk/tape functions.
(orca_io_info_update): call this function only if USE_KSTAT_IO is defined and
at least one of WATCH_DISK/TAPE is defined. Save time if not watching io.
Fixed some comments.
Modified: trunk/orca/data_gatherers/orcallator/orcallator.se
==============================================================================
--- trunk/orca/data_gatherers/orcallator/orcallator.se (original)
+++ trunk/orca/data_gatherers/orcallator/orcallator.se Tue Oct 5 08:18:50 2004
@@ -24,7 +24,9 @@
#define MAX_COLUMNS 2048
// Enable kstat io measuring code.
+#ifndef NO_KSTAT_IO
#define USE_KSTAT_IO 1
+#endif
// If WATCH_OS is defined, then measure every part of the operating
// system.
@@ -37,6 +39,7 @@
#define WATCH_NFS_SERVER 1
#define WATCH_MOUNTS 1
#define WATCH_DISK 1
+#define WATCH_TAPE 1
#define WATCH_DNLC 1
#define WATCH_INODE 1
#define WATCH_RAM 1
@@ -300,17 +303,14 @@
#ifdef USE_KSTAT_IO
#include <sys_kstat.se>
#include <tapeinfo.se>
-// This code was developed so that the performance of virtual disks
-// originating from a Sun A1000 raid controller could be monitored.
-// These disks do not show up in the GLOBAL_disk[] io structure of SE.
-//
-// This extension accesses the sys_kstat.se interface to the kstat IO
-// queues to extract info on drives not available in the kstat.se
-// kstat$disk interface. Global data shared between function calls.
+// The following code collects performance data for disk and/or tape devices
+// by accessing kstat interface directly. It was originally developed to
+// overcome limitation of GLOBAL_disk[] array populated in live_rules.se.
struct io_dev_info_t {
// Exposed interface that matches kstat.
string long_name;
string short_name;
+ string dev_class;
double reads;
double kreads;
double writes;
@@ -337,7 +337,7 @@
uint _rcnt; // Count of elements in run state
};
-// Define global for tracking raw disk data.
+// Define globals for tracking kstat io data.
io_dev_info_t ORCA_io_dev_info[];
int ORCA_io_dev_count=0;
int ORCA_max_io_dev_count=0;
@@ -362,7 +362,13 @@
struct_fill(nkp[0], ul);
if (nkp[0].ks_type == KSTAT_TYPE_IO) {
// Look for disk or tape statistics
+#if defined (WATCH_DISK) && defined (WATCH_TAPE)
if (nkp[0].ks_class == "disk" || nkp[0].ks_class == "tape") {
+#elif defined (WATCH_TAPE)
+ if (nkp[0].ks_class == "tape") {
+#else
+ if (nkp[0].ks_class == "disk") {
+#endif
// Get data from the kernel for this kstat
if (kstat_read(kc, nkp, 0) == -1) {
perror("orca_io_info_update:kstat_read error");
@@ -384,7 +390,7 @@
ORCA_max_io_dev_count += 10;
ORCA_io_dev_info = renew ORCA_io_dev_info[ORCA_max_io_dev_count];
}
-
+ // Lookup index into GLOBAL_disk/tape_info array
if (nkp[0].ks_class == "tape") {
index = find_tape_inst(nkp[0].ks_name);
} else {
@@ -399,8 +405,8 @@
} else {
ORCA_io_dev_info[iodev].long_name = nkp[0].ks_name;
}
- ORCA_io_dev_info[iodev].short_name = nkp[0].ks_name;
-
+ ORCA_io_dev_info[iodev].short_name = nkp[0].ks_name;
+ ORCA_io_dev_info[iodev].dev_class = nkp[0].ks_class;
ORCA_io_dev_info[iodev]._writes = kio.writes;
ORCA_io_dev_info[iodev]._nwritten = kio.nwritten;
ORCA_io_dev_info[iodev]._wlastupdate = kio.wlastupdate;
@@ -691,6 +697,7 @@
fprintf(stderr, " -DWATCH_NFS_SERVER watch NFS server requests\n");
fprintf(stderr, " -DWATCH_MOUNTS watch usage of mount points\n");
fprintf(stderr, " -DWATCH_DISK watch disk read/write usage\n");
+ fprintf(stderr, " -DWATCH_TAPE watch tape read/write usage\n");
fprintf(stderr, " -DWATCH_DNLC watch the directory name lookup cache\n");
fprintf(stderr, " -DWATCH_INODE watch the inode cache\n");
fprintf(stderr, " -DWATCH_RAM watch memory usage\n");
@@ -861,7 +868,7 @@
tmp_tcp = tcp$tcp;
#endif
-#ifdef USE_KSTAT_IO
+#if defined (USE_KSTAT_IO) && (defined (WATCH_DISK) || defined (WATCH_TAPE))
orca_io_info_update();
#endif
}
@@ -901,6 +908,11 @@
measure_disk();
#endif
+ // Take care of the tapes.
+#if defined (WATCH_TAPE) && defined (USE_KSTAT_IO)
+ measure_tape();
+#endif
+
// Take care of ram.
#ifdef WATCH_RAM
measure_ram();
@@ -1399,10 +1411,9 @@
#ifdef WATCH_DISK
measure_disk()
{
- // These two variables are treated as static variables to keep track
- // of any changes to the number of disks and tapes on the system.
+ // This variable is treated as static variable to keep track
+ // of any changes to the number of disks on the system.
int previous_disk_count = -1;
- int previous_tape_count = -1;
double mean_disk_busy;
double peak_disk_busy;
@@ -1412,12 +1423,6 @@
double total_disk_writek;
int disk_count;
- double total_tape_reads;
- double total_tape_writes;
- double total_tape_readk;
- double total_tape_writek;
- int tape_count;
-
int i;
mean_disk_busy = 0.0;
@@ -1428,62 +1433,43 @@
total_disk_writek = 0.0;
disk_count = 0;
- total_tape_reads = 0.0;
- total_tape_writes = 0.0;
- total_tape_readk = 0.0;
- total_tape_writek = 0.0;
- tape_count = 0;
-
#ifdef USE_KSTAT_IO
for (i=0; i<ORCA_io_dev_count; ++i) {
- // Record tape drive st devices differently than regular disk devices.
- if (ORCA_io_dev_info[i].short_name =~ "^st.*") {
- tape_count++;
- total_tape_reads += ORCA_io_dev_info[i].reads;
- total_tape_writes += ORCA_io_dev_info[i].writes;
- total_tape_readk += ORCA_io_dev_info[i].kreads;
- total_tape_writek += ORCA_io_dev_info[i].kwrites;
- put_output(sprintf("tape_runp_%s", ORCA_io_dev_info[i].long_name),
+ if (ORCA_io_dev_info[i].dev_class == "disk") {
+ disk_count++;
+ put_output(sprintf("disk_runp_%s", ORCA_io_dev_info[i].long_name),
sprintf("%16.5f", ORCA_io_dev_info[i].run_percent));
- continue;
- }
- // Block the listing of floppy drives for now.
- if (ORCA_io_dev_info[i].short_name =~ "^fd.*") {
- continue;
- }
- disk_count++;
- put_output(sprintf("disk_runp_%s", ORCA_io_dev_info[i].long_name),
- sprintf("%16.5f", ORCA_io_dev_info[i].run_percent));
- put_output(sprintf("disk_svct_%s", ORCA_io_dev_info[i].long_name),
- sprintf("%16.5f", ORCA_io_dev_info[i].service));
+ put_output(sprintf("disk_svct_%s", ORCA_io_dev_info[i].long_name),
+ sprintf("%16.5f", ORCA_io_dev_info[i].service));
- // Comments from Damon Atkins <Damon.Atkins at nabaus.com.au>. Check
- // [wr]lentime to see if an EMC is using a fake disk for control.
- // EMC disks have a fake disk which commands are run over to
- // configure the disk array or to get stats from; they are not
- // real data transfers. They cause 1000 MB/sec writes to appear
- // in the stats. I still get them but not as often with this bit
- // of code in. If the I/O which occurred in the last five minutes
- // is not greater than 1/100sec then it is not a valid measurement
- // anyway. What happens is that we can have a small I/O, say 1024
- // bytes, in a 1/100sec = 1024*100/sec. I am thinking of making
- // it wlentime+rlentime>2 since I am still getting fake write
- // spikes.
+ // Comments from Damon Atkins <Damon.Atkins at nabaus.com.au>. Check
+ // [wr]lentime to see if an EMC is using a fake disk for control.
+ // EMC disks have a fake disk which commands are run over to
+ // configure the disk array or to get stats from; they are not
+ // real data transfers. They cause 1000 MB/sec writes to appear
+ // in the stats. I still get them but not as often with this bit
+ // of code in. If the I/O which occurred in the last five minutes
+ // is not greater than 1/100sec then it is not a valid measurement
+ // anyway. What happens is that we can have a small I/O, say 1024
+ // bytes, in a 1/100sec = 1024*100/sec. I am thinking of making
+ // it wlentime+rlentime>2 since I am still getting fake write
+ // spikes.
#ifdef HAVE_EMC_DISK_CONTROL
- if ((pioGLOB_old_wlentime[i] + pioGLOB_old_rlentime[i]) > 1) {
+ if ((pioGLOB_old_wlentime[i] + pioGLOB_old_rlentime[i]) > 1) {
#endif
- total_disk_reads += ORCA_io_dev_info[i].reads;
- total_disk_writes += ORCA_io_dev_info[i].writes;
- total_disk_readk += ORCA_io_dev_info[i].kreads;
- total_disk_writek += ORCA_io_dev_info[i].kwrites;
- mean_disk_busy += ORCA_io_dev_info[i].run_percent;
- if (ORCA_io_dev_info[i].run_percent > peak_disk_busy) {
- peak_disk_busy = ORCA_io_dev_info[i].run_percent;
- }
+ total_disk_reads += ORCA_io_dev_info[i].reads;
+ total_disk_writes += ORCA_io_dev_info[i].writes;
+ total_disk_readk += ORCA_io_dev_info[i].kreads;
+ total_disk_writek += ORCA_io_dev_info[i].kwrites;
+ mean_disk_busy += ORCA_io_dev_info[i].run_percent;
+ if (ORCA_io_dev_info[i].run_percent > peak_disk_busy) {
+ peak_disk_busy = ORCA_io_dev_info[i].run_percent;
+ }
#ifdef HAVE_EMC_DISK_CONTROL
- }
+ }
#endif
+ }
}
#else
for (i=0; i<GLOBAL_disk_count; ++i) {
@@ -1534,17 +1520,55 @@
put_output("disk_rK/s", sprintf("%9.1f", total_disk_readk));
put_output("disk_wK/s", sprintf("%9.1f", total_disk_writek));
+ // If the number of disks has changed, say due to a
+ // add_drv, then print new headers.
+ if (previous_disk_count != disk_count) {
+ print_header = 1;
+ previous_disk_count = disk_count;
+ }
+}
+#endif
+
+#if defined (WATCH_TAPE) && defined (USE_KSTAT_IO)
+measure_tape()
+{
+ // This variable is treated as static variable to keep track
+ // of any changes to the number of tapes on the system.
+ int previous_tape_count = -1;
+
+ double total_tape_reads;
+ double total_tape_writes;
+ double total_tape_readk;
+ double total_tape_writek;
+ int tape_count;
+
+ int i;
+
+ total_tape_reads = 0.0;
+ total_tape_writes = 0.0;
+ total_tape_readk = 0.0;
+ total_tape_writek = 0.0;
+ tape_count = 0;
+
+ for (i=0; i<ORCA_io_dev_count; ++i) {
+ if (ORCA_io_dev_info[i].dev_class == "tape") {
+ tape_count++;
+ total_tape_reads += ORCA_io_dev_info[i].reads;
+ total_tape_writes += ORCA_io_dev_info[i].writes;
+ total_tape_readk += ORCA_io_dev_info[i].kreads;
+ total_tape_writek += ORCA_io_dev_info[i].kwrites;
+ put_output(sprintf("tape_runp_%s", ORCA_io_dev_info[i].long_name),
+ sprintf("%16.5f", ORCA_io_dev_info[i].run_percent));
+ }
+ }
+
put_output("tape_rd/s", sprintf("%9.1f", total_tape_reads));
put_output("tape_wr/s", sprintf("%9.1f", total_tape_writes));
put_output("tape_rK/s", sprintf("%9.1f", total_tape_readk));
put_output("tape_wK/s", sprintf("%9.1f", total_tape_writek));
- // If the number of disks and/or tapes has changed, say due to a
+ // If the number of tapes has changed, say due to a
// add_drv, then print new headers.
- if (previous_disk_count != disk_count) {
- print_header = 1;
- previous_disk_count = disk_count;
- }
if (previous_tape_count != tape_count) {
print_header = 1;
previous_tape_count = tape_count;
More information about the Orca-checkins
mailing list