fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <errno.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdio.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <unistd.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <strings.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <stdlib.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/types.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/time.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/sdbc_ioctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/rdc_ioctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/sd_bcache.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/sd_conf.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/rdc_io.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/nsctl/rdc_bitmap.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/unistat/spcs_s_u.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <curses.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic rdc_status_t *rdc_status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic rdc_u_info_t *rdc_info;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdc_maxsets;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rdc_enabled_sets;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic unsigned prev_time, delta_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef m88k
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern unsigned *usec_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int bright = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int sdbc_max_devices;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern _sd_stats_t *cs_cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern _sd_stats_t *cs_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern _sd_stats_t *cs_persec;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int *on_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int *dual_on_off;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int *updates_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern double *rate_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int *samples;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint range_num = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint screen = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint dual_screen = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int rnum = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int lb, ub;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} range_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterange_t ranges[100];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int range_first();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int range_next(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int range_last();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int dual_initted = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char status[11][30];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteunsigned dc_delta_time, dc_prev_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef m88k
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define USEC_INIT() usec_ptr = (unsigned int *)timer_init()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define USEC_READ() (*usec_ptr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* !m88k */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define USEC_INIT() USEC_START()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/time.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct timeval Usec_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int Usec_started = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid total_display(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid disp_stats(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid do_calc(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid init_dual(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid calc_time(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid calc_completion(int, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid disp_total_stats(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid display_cache(void);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define DISPLEN 16
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteUSEC_START(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!Usec_started) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) gettimeofday(&Usec_time, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte Usec_started = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic unsigned int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn ForteUSEC_READ()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct timeval tv;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!Usec_started)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte USEC_START();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) gettimeofday(&tv, NULL);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (unsigned)((tv.tv_sec - Usec_time.tv_sec) * 1000000 +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (tv.tv_usec - Usec_time.tv_usec));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* m88k */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SAMPLE_RATE 5
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * refresh curses window to file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortewrefresh_file(WINDOW *win, int fd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char buf[8192], c, *cp = buf, *line, *blank, *empty;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int x, y;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte empty = NULL; /* cull trailing empty lines */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (y = 0; y < win->_maxy; y++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte line = cp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte blank = NULL; /* cull trailing blanks */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (x = 0; x < win->_maxx; x++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte c = (win->_y[y][x]) & A_CHARTEXT;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (c != ' ')
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte blank = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (blank == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte blank = cp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *cp++ = c;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (blank)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cp = blank;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (line != cp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte empty = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (empty == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte empty = cp + 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *cp++ = '\n';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (empty)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cp = empty;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *cp++ = '\f'; *cp++ = '\n'; *cp = '\0';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* cp is eliminated by short _maxy and _maxx, it won't overflow */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* LINTED, cp - buf won't be > INT32_MAX */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) write(fd, buf, cp - buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortehigher(int high)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = high + 1; i <= sdbc_max_devices; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_alloc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (i);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteis_dirty()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, dirty = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t ustats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte &ustats) == SPCS_S_ERROR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror("Could not get stats from kernel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ustats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_report(ustats, stderr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_ufree(&ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-errno);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_cachesize == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < cs_cur->st_count; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_alloc)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dirty += cs_cur->st_shared[i].sh_numdirty;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (dirty != 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_cache(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte static int first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t ustats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0, &ustats) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPCS_S_ERROR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror("sd_stats");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ustats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_report(ustats, stderr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_ufree(&ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte do_calc();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte prev_time = USEC_READ();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disp_stats();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetotal_display(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t ustats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0, &ustats) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte SPCS_S_ERROR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ustats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_report(ustats, stderr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_ufree(&ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte perror("sd_stats");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte disp_total_stats();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterange_first()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rnum = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ranges[rnum].lb);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterange_next(int cd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ranges[rnum].ub > cd)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (cd + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (range_num > rnum)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rnum++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (cd + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ranges[rnum].lb);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterange_last() {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (ranges[range_num].ub);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteset_dual_on_off()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, j, ct = 0, newct = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = range_first(); i < rdc_enabled_sets && i <= range_last();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte i = range_next(i)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[i].flags & RDC_ENABLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ct++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ct > dual_screen * ((LINES - 9) / 2))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((i >= rdc_enabled_sets) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (i > range_last())) && (dual_screen > 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dual_screen--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_dual_on_off();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(dual_on_off, sdbc_max_devices * sizeof (int));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = i; j < rdc_enabled_sets && j <= range_last();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j = range_next(j)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[j].flags & RDC_ENABLED) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte newct++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (newct <= (LINES - 9) / 2) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dual_on_off[j] = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteset_on_off()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, j, ct = 0, newct = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = range_first(); i <= range_last(); i = range_next(i)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_alloc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ct++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ct > screen*((LINES - 9) / 2))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((i > range_last()) && (screen > 0)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte screen--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_on_off();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bzero(on_off, sdbc_max_devices * sizeof (int));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = i; j <= range_last(); j = range_next(j)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[j].sh_alloc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte newct++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (newct <= (LINES - 9) / 2)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte on_off[j] = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisp_stats(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double read_s, write_s, access_s, readp, writep;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double rmiss_s, wmiss_s;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double elapsed = delta_time / 1000000.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double kbps = elapsed * 1024.0; /* for Kbytes per second */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rtotal, wtotal, i, j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double throughput = 0.0, rthroughput = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double creads = 0.0, cwrites = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char status_bit, down = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fn[19];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (delta_time != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte read_s = cs_persec->st_rdhits / elapsed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte write_s = cs_persec->st_wrhits / elapsed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rmiss_s = cs_persec->st_rdmiss / elapsed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wmiss_s = cs_persec->st_wrmiss / elapsed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte access_s = (cs_persec->st_wrhits + cs_persec->st_rdhits +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_rdmiss + cs_persec->st_wrmiss) / elapsed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte read_s = write_s = access_s = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rtotal = cs_persec->st_rdhits + cs_persec->st_rdmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wtotal = cs_persec->st_wrhits + cs_persec->st_wrmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rtotal != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte readp = cs_persec->st_rdhits / (double)rtotal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte readp = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wtotal != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte writep = cs_persec->st_wrhits / (double)wtotal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte writep = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_on_off();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_cachesize == 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Storage Cache Disabled ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Storage Cache ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(2, 26, "disk_io cache write_blocks");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(3, 1, " cd cached_partition reads writes reads writes"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " dirty todisk failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, j = 0; j < cs_cur->st_count; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= sdbc_max_devices)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_alloc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_disk_write /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_disk_read /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_cache_write /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_cache_read /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rthroughput += cs_persec->st_shared[i].sh_disk_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throughput += cs_persec->st_shared[i].sh_disk_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte creads += cs_persec->st_shared[i].sh_cache_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cwrites += cs_persec->st_shared[i].sh_cache_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!down)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte down = cs_cur->st_shared[i].sh_failed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_failed && bright) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_bit = '*';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_bit = ' ';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((len = strlen(cs_cur->st_shared[i].sh_filename))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte > 15) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(fn, "...");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcat(fn,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki cs_cur->st_shared[i].sh_filename +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len - 12);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(fn,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki cs_cur->st_shared[i].sh_filename);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (on_off[i]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + j, 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3d %-15s%c %6d %6d %6d %6d %6d %6d %6d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_cd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_bit,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_disk_read,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_disk_write,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_cache_read,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_cache_write,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_numdirty,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_numio,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_numfail);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bright = !bright;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + j, 22, "------ ------ ------ ------");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(5 + j, 6, " Kbytes/s total:%6d %6d %6d %6d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)rthroughput, (int)throughput,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)creads, (int)cwrites);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(7 + j, 1, "accesses/s");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(7 + j, 15, "read/s write/s %%readh %%writeh");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 1, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 13,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 13, "(misses/s) (misses/s)");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(9 + j, 0, "%10.2lf %7.2f %7.2f %6.1f %6.1f",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte access_s, read_s, write_s, readp * 100.0, writep * 100.0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(10 + j, 0, " (%7.2f ) (%7.2f )\n\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rmiss_s, wmiss_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (down)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(20 + j, 1, "* -- disk off-line");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedo_calc(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int i, j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte delta_time = USEC_READ() - prev_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_rdhits = cs_cur->st_rdhits - cs_prev->st_rdhits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_rdmiss = cs_cur->st_rdmiss - cs_prev->st_rdmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_wrhits = cs_cur->st_wrhits - cs_prev->st_wrhits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_wrmiss = cs_cur->st_wrmiss - cs_prev->st_wrmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, j = 0; j < cs_cur->st_count; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= sdbc_max_devices)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_alloc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_disk_write =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FBA_SIZE(cs_cur->st_shared[i].sh_disk_write -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_prev->st_shared[i].sh_disk_write);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_disk_read =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FBA_SIZE(cs_cur->st_shared[i].sh_disk_read -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_prev->st_shared[i].sh_disk_read);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_cache_read =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FBA_SIZE(cs_cur->st_shared[i].sh_cache_read -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_prev->st_shared[i].sh_cache_read);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_persec->st_shared[i].sh_cache_write =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte FBA_SIZE(cs_cur->st_shared[i].sh_cache_write -
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_prev->st_shared[i].sh_cache_write);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) memcpy((char *) cs_prev, (char *) cs_cur, sizeof (_sd_stats_t) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (sdbc_max_devices - 1) * sizeof (_sd_shared_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte prev_time = USEC_READ();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteinit_dual(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_ENABLED 0
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_RESYNC 1
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_RESYNC_REVERSE 2
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_VOLUME_DOWN 3
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_MIRROR_DOWN 4
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_LOGGING 5
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_RESYNC_NEEDED 6
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_REV_RESYNC_NEEDED 7
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_BITMAP_FAILED 8
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_FULL_SYNC_NEEDED 9
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define IND_FCAL_FAILED 10
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_ENABLED], "replicating");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_RESYNC], "sync");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_RESYNC_REVERSE], "rev sync");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_VOLUME_DOWN], "volume down");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_MIRROR_DOWN], "mirror down");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_LOGGING], "logging");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_RESYNC_NEEDED], "need sync");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_REV_RESYNC_NEEDED], "need rev sync");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_BITMAP_FAILED], "bitmap failed");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_FULL_SYNC_NEEDED], "full sync needed");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_FCAL_FAILED], "fcal failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dual_initted = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forterdc_get_maxsets(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_status_t rdc_status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t ustatus;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rc;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_status.nset = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ustatus = spcs_s_ucreate();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rc = RDC_IOCTL(RDC_STATUS, &rdc_status, 0, 0, 0, 0, ustatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_ufree(&ustatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rc == SPCS_S_ERROR)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rdc_status.maxsets);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedual_stats()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int ind, i, k, len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int stars, size, segs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rdcindex;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte float pct;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fn[19];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *phost;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *shost;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *pfile;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *sfile;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char lhost[16];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_info_t ustats = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) gethostname(lhost, 16);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_maxsets <= 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_maxsets = rdc_get_maxsets();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_maxsets < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte goto no_stats;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!rdc_status) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_status = malloc(sizeof (rdc_status_t) +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (sizeof (rdc_set_t) * (rdc_maxsets - 1)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!rdc_status) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteno_stats:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "****** Dual Copy Not Available ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info = rdc_status->rdc_set;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_status->nset = rdc_maxsets;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ustats = spcs_s_ucreate();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size = RDC_IOCTL(RDC_STATUS, rdc_status, 0, 0, 0, 0, ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (size == SPCS_S_ERROR) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ustats) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_report(ustats, stderr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_ufree(&ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Dual Copy Not Available ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte spcs_s_ufree(&ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_enabled_sets = rdc_status->nset;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!dual_initted)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte init_dual();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_dual_on_off();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calc_time();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Dual Copy Statistics ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(2, 0, "primary");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(2, 22, "link status");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(2, 36, "secondary");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(2, 54, "dual copy status");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (rdcindex = 0, k = 0; rdcindex < rdc_enabled_sets; rdcindex++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(rdc_info[rdcindex].flags & RDC_ENABLED) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !dual_on_off[rdcindex])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].sync_flags & RDC_VOL_FAILED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_VOLUME_DOWN;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (rdc_info[rdcindex].flags & RDC_FCAL_FAILED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_FCAL_FAILED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (rdc_info[rdcindex].bmap_flags & RDC_BMP_FAILED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_BITMAP_FAILED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (rdc_info[rdcindex].flags & RDC_LOGGING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].sync_flags &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RDC_SYNC_NEEDED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_RESYNC_NEEDED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (rdc_info[rdcindex].sync_flags &
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte RDC_RSYNC_NEEDED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_REV_RESYNC_NEEDED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_LOGGING;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((rdc_info[rdcindex].flags & RDC_SLAVE) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (rdc_info[rdcindex].flags & RDC_SYNCING)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].flags & RDC_PRIMARY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_RESYNC_REVERSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_RESYNC;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (rdc_info[rdcindex].flags & RDC_SYNCING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].flags & RDC_PRIMARY)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_RESYNC;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_RESYNC_REVERSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ind = IND_ENABLED;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phost = rdc_info[rdcindex].primary.intf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pfile = rdc_info[rdcindex].primary.file;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte shost = rdc_info[rdcindex].secondary.intf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sfile = rdc_info[rdcindex].secondary.file;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((len = strlen(phost)) > 8) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 0, ".%+7s:",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phost + len - 7);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 0, "%+8s:", phost);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((len = strlen(pfile)) > DISPLEN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 9, "...%-13s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pfile + len - DISPLEN + 3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 9, "%-16s", pfile);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_BOLD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 26, "*");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 28, "*");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 56, "%-8s", status[ind]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_BOLD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ind == IND_RESYNC_REVERSE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bright && !(rdc_info[rdcindex].flags & RDC_LOGGING))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 27, "<");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].flags & RDC_PRIMARY &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(rdc_info[rdcindex].flags & RDC_LOGGING))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calc_completion(rdcindex,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info[rdcindex].bits_set, 4 + k);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ind == IND_RESYNC) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bright && !(rdc_info[rdcindex].flags & RDC_LOGGING))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 27, ">");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].flags & RDC_PRIMARY &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(rdc_info[rdcindex].flags & RDC_LOGGING))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte calc_completion(rdcindex,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info[rdcindex].bits_set, 4 + k);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (ind == IND_LOGGING)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 27, ".");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (ind == IND_ENABLED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 27, "=");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((len = strlen(shost)) > 8) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 30, ".%+7s:",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte shost + len - 7);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 30, "%+8s:", shost);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((len = strlen(sfile)) > DISPLEN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 39, "...%-13s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sfile + len - DISPLEN + 3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + k, 39, "%-16s", sfile);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k += 5;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 80; i++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, i, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k += 2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 0, "partition");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 16, "recovery needed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 48, "recovery completed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k += 2;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (rdcindex = 0; rdcindex < rdc_enabled_sets; rdcindex++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(rdc_info[rdcindex].flags & RDC_ENABLED) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !dual_on_off[rdcindex])
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(rdc_info[rdcindex].flags & RDC_PRIMARY)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(rdc_info[rdcindex].flags & RDC_SLAVE) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(rdc_info[rdcindex].flags & RDC_SYNCING) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte !(rdc_info[rdcindex].flags & RDC_LOGGING)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len = strlen(rdc_info[rdcindex].secondary.file);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (len > 15) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(fn, "...");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcat(fn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rdc_info[rdcindex].secondary.file + len - 12);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(fn, rdc_info[rdcindex].secondary.file);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 0, "%-15s", fn);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte segs = FBA_TO_LOG_LEN(rdc_info[rdcindex].volume_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pct = segs ?
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((float)rdc_info[rdcindex].bits_set / (float)segs) : 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stars = (int)(pct * 20.0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (stars > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 16 + stars, "*");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stars--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_BOLD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 16, "[");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 37, "]");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_BOLD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 39, "%6.2f%%", pct * 100.0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].flags & RDC_SYNCING)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pct = ((float)rdc_info[rdcindex].sync_pos /
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (float)rdc_info[rdcindex].volume_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pct = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stars = (int)(pct * 20.0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (stars > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 48 + stars, "*");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte stars--;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_BOLD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 48, "[");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 69, "]");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_BOLD);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(k, 70, "%6.2f%%", pct * 100.0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte k++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bright = !bright;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate a time interval in milliseconds using the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * micosecond counter
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecalc_time(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur = USEC_READ();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dc_delta_time = cur > dc_prev_time ? cur - dc_prev_time :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cur + 0xFFFFFFFF - dc_prev_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dc_delta_time /= 1000;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dc_prev_time = cur;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate estimated time of completion of resync
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortecalc_completion(int cd, int updates_left, int l)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int delta_done;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double rate;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte long time_left;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte long hours;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte long minutes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte static int initted = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!initted) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte updates_prev[cd] = updates_left;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte initted = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Caclulate updates since last check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte delta_done = updates_prev[cd] - updates_left;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte updates_prev[cd] = updates_left;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If no updates, don't bother estimating completion time
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (delta_done <= 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte samples[cd] = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rate = delta_done * 1000.0 / dc_delta_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate rate of updates as a weighted average
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of previous and current rate
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rate_prev[cd] && samples[cd] > SAMPLE_RATE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rate = (rate_prev[cd] * 4.0 + rate) / 5.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rate_prev[cd] = rate;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte samples[cd]++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get enough samples before making estimate
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (samples[cd]++ < SAMPLE_RATE)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_left = (long)(updates_left/rate); /* time left in seconds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (time_left < 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte hours = time_left / (60 * 60);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_left -= hours * (60 * 60);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte minutes = time_left / 60;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_left -= minutes * 60;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(l, 67,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "time %02d:%02d:%02d \n", hours, minutes, time_left);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisp_total_stats(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int read_s, write_s, access_s;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double readp, writep;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int rmiss_s, wmiss_s;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double kbps = 2.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rtotal, wtotal, i, j;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int throughput = 0, rthroughput = 0, creads = 0, cwrites = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char status_bit, down = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int len;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char fn[19];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte read_s = cs_cur->st_rdhits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte write_s = cs_cur->st_wrhits;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rmiss_s = cs_cur->st_rdmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wmiss_s = cs_cur->st_wrmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte access_s = (read_s + write_s + rmiss_s + wmiss_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rtotal = cs_cur->st_rdhits + cs_cur->st_rdmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wtotal = cs_cur->st_wrhits + cs_cur->st_wrmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rtotal != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte readp = cs_cur->st_rdhits / (double)rtotal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte readp = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wtotal != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte writep = cs_cur->st_wrhits / (double)wtotal;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte writep = 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte set_on_off();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 14,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "****** Storage Cache (Cumulative) ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(2, 30, "disk_io cache");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(3, 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " cd cached_partition reads writes reads writes");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0, j = 0; j < cs_cur->st_count; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (i >= sdbc_max_devices)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_alloc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_disk_write /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_disk_read /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_cache_write /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_cache_read /= kbps;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rthroughput += cs_cur->st_shared[i].sh_disk_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throughput += cs_cur->st_shared[i].sh_disk_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte creads += cs_cur->st_shared[i].sh_cache_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cwrites += cs_cur->st_shared[i].sh_cache_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!down)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte down = cs_cur->st_shared[i].sh_failed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (cs_cur->st_shared[i].sh_failed && bright)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_bit = '*';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_bit = ' ';
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((len =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(cs_cur->st_shared[i].sh_filename)) > 15) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(fn, "...");
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcat(fn,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki cs_cur->st_shared[i].sh_filename +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte len - 12);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(fn,
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki cs_cur->st_shared[i].sh_filename);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (on_off[i]) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + j, 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3d %-15s%c %10u %10u %10u %10u",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_cd,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fn,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status_bit,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_disk_read,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_disk_write,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_cache_read,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_shared[i].sh_cache_write);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte j++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bright = !bright;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + j, 22,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "---------- ---------- ---------- ----------");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(5 + j, 8, " Kbytes total:%10u %10u %10u %10u",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)rthroughput, (int)throughput,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)creads, (int)cwrites);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(7 + j, 1, " accesses");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(7 + j, 18, "read write %%readh %%writeh");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 1, " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 13,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 11, "( misses) ( misses)");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(9 + j, 0, "%10u %10u %10u %6.1f %6.1f",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte access_s, read_s, write_s, readp*100.0, writep*100.0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(10 + j, 0,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " (%10u) (%10u)\n\n", rmiss_s, wmiss_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(13 + j, 1, "cachesize blocksize");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(14 + j, 1, "%8dK %10d", cs_cur->st_cachesize / 1024,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_blksize);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(16 + j, 1, "Write blocks available:");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(17 + j, 1, "Net 0: %6d", cs_cur->st_wlru_inq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attron(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(19 + j, 1, "LRU stats: Blocks Requeued Optimized");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) attroff(A_UNDERLINE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(20 + j, 7, "%12d %12u %12u", cs_cur->st_lru_blocks,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cs_cur->st_lru_req, cs_cur->st_lru_noreq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (down)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(25 + j, 1, "* -- disk off-line");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}