/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <stdio.h>
#include <string.h>
#include <kstat.h>
#include <sys/inttypes.h>
#include <nsctl.h>
#include "dsstat.h"
#include "common.h"
#include "sdbc_stats.h"
#include "report.h"
extern short dflags;
/*
* Return the number of ticks delta between two hrtime_t
* values. Attempt to cater for various kinds of overflow
* in hrtime_t - no matter how improbable.
*/
{
} else {
/*
* We've overflowed the positive portion of an
* hrtime_t.
*/
if (new < 0L) {
/*
* The new value is negative. Handle the
* case where the old value is positive or
* negative.
*/
if (old > 0L) {
} else {
return (del);
}
} else {
/*
* Either we've just gone from being negative
* to positive *or* the last entry was positive
* and the new entry is also positive but *less*
* than the old entry. This implies we waited
* quite a few days on a very fast system between
* iostat displays.
*/
if (old < 0L) {
} else {
}
return (del);
}
}
}
/*
* Take the difference of an unsigned 32
* bit int attempting to cater for
* overflow.
*/
{
else
}
/*
* Take the difference of an unsigned 64
* bit int attempting to cater for
* overflow.
*/
{
else
}
/*
* io_report() - diffs and reports data contained in
* kstat_io_t structures.
*
* parameters
* kstat_io_t *cur - pointer to current data
*
* kstat_io_t *pre - pointer to data as it was
* at the beginning of an interval.
*/
void
{
if (sdbcstat &&
return;
/* Time */
/* Read count */
/* Bytes read */
/* Write count */
/* Bytes written */
/* Calculate service times */
if (tps > 0)
else
rtm = 0.0;
/* Output */
if (sdbcstat) {
(void) printf(KPS_INF_FMT,
(float)vals.total_cache);
(void) printf(KPS_INF_FMT,
(float)vals.total_disk);
} else {
}
} else
goto done;
}
if (sdbcstat) {
(void) printf(KPS_INF_FMT,
(float)vals.cache_read);
(void) printf(KPS_INF_FMT,
} else {
}
} else
}
if (sdbcstat) {
(void) printf(KPS_INF_FMT,
(float)vals.cache_write);
(void) printf(KPS_INF_FMT,
(float)vals.disk_write);
} else {
}
} else
}
}
done:
linesout++;
}
int
{
return (1);
return (1);
return (0);
}
/*
* cd_report() - reports cache desriptor related statistics
* based on the dflags global variable
*
* parameters
* sdbcstat_t *sdbcstat - pointer to the cache structure
* to be reported on.
*/
void
{
/* Extract statistics, average for time */
return;
/* Output */
}
(void) printf("\n");
linesout++;
return;
}
}
}
}
linesout++;
(void) printf("\n");
return;
}
linesout++;
(void) printf("\n");
return;
}
}
}
linesout++;
(void) printf("\n");
}
/*
* header() - outputs an appropriate header by referencing the
* global variables dflsgs and rflags
*
*/
void
header()
{
if (hflags & HEADERS_EXL)
if ((linesout % DISPLAY_LINES) != 0)
return;
if (hflags & HEADERS_BOR)
if (linesout != 0)
return;
if (hflags & HEADERS_ATT)
if (hflags & HEADERS_OUT)
return;
else
hflags |= HEADERS_OUT;
if (linesout)
(void) printf("\n");
}
if (dflags & ASYNC_QUEUE)
if (dflags & ASYNC_QUEUE) {
}
} else
(void) printf("\n");
return;
}
} else
}
} else
}
(void) printf("\n");
}