fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
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 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
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 * CDDL HEADER END
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern unsigned *usec_ptr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern double *rate_prev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern int range_next(int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define USEC_INIT() usec_ptr = (unsigned int *)timer_init()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else /* !m88k */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid calc_completion(int, int, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic unsigned int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (unsigned)((tv.tv_sec - Usec_time.tv_sec) * 1000000 +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* m88k */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * refresh curses window to file
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char buf[8192], c, *cp = buf, *line, *blank, *empty;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (c != ' ')
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 return (dirty != 0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0, &ustats) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (SDBC_IOCTL(SDBC_STATS, cs_cur, 0, 0, 0, 0, &ustats) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = range_first(); i < rdc_enabled_sets && i <= range_last();
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 for (i = range_first(); i <= range_last(); i = range_next(i)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (j = i; j <= range_last(); j = range_next(j)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte double kbps = elapsed * 1024.0; /* for Kbytes per second */
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 rtotal = cs_persec->st_rdhits + cs_persec->st_rdmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wtotal = cs_persec->st_wrhits + cs_persec->st_wrmiss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Storage Cache Disabled ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Storage Cache ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(2, 26, "disk_io cache write_blocks");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(3, 1, " cd cached_partition reads writes reads writes"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " dirty todisk failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rthroughput += cs_persec->st_shared[i].sh_disk_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throughput += cs_persec->st_shared[i].sh_disk_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cwrites += cs_persec->st_shared[i].sh_cache_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((len = strlen(cs_cur->st_shared[i].sh_filename))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3d %-15s%c %6d %6d %6d %6d %6d %6d %6d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(4 + j, 22, "------ ------ ------ ------");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(5 + j, 6, " Kbytes/s total:%6d %6d %6d %6d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(7 + j, 15, "read/s write/s %%readh %%writeh");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 13, "(misses/s) (misses/s)");
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 (void) mvprintw(20 + j, 1, "* -- disk off-line");
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 (void) memcpy((char *) cs_prev, (char *) cs_cur, sizeof (_sd_stats_t) +
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(status[IND_ENABLED], "replicating");
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_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 rc = RDC_IOCTL(RDC_STATUS, &rdc_status, 0, 0, 0, 0, ustatus);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "****** Dual Copy Not Available ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte size = RDC_IOCTL(RDC_STATUS, rdc_status, 0, 0, 0, 0, ustats);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Dual Copy Not Available ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (-1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(0, 20, "****** Dual Copy Statistics ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (rdcindex = 0, k = 0; rdcindex < rdc_enabled_sets; rdcindex++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rdc_info[rdcindex].sync_flags & RDC_VOL_FAILED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (rdc_info[rdcindex].flags & RDC_FCAL_FAILED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (rdc_info[rdcindex].bmap_flags & RDC_BMP_FAILED)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte else if (rdc_info[rdcindex].flags & RDC_LOGGING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((rdc_info[rdcindex].flags & RDC_SLAVE) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (rdc_info[rdcindex].flags & RDC_SYNCING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bright && !(rdc_info[rdcindex].flags & RDC_LOGGING))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (bright && !(rdc_info[rdcindex].flags & RDC_LOGGING))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < 80; i++)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (rdcindex = 0; rdcindex < rdc_enabled_sets; rdcindex++) {
570de38f63910201fdd77246630b7aa8f9dc5661Surya Prakki (void) strcpy(fn, rdc_info[rdcindex].secondary.file);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte segs = FBA_TO_LOG_LEN(rdc_info[rdcindex].volume_size);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((float)rdc_info[rdcindex].bits_set / (float)segs) : 0.0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (stars > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (stars > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate a time interval in milliseconds using the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * micosecond counter
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dc_delta_time = cur > dc_prev_time ? cur - dc_prev_time :
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate estimated time of completion of resync
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Caclulate updates since last check
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If no updates, don't bother estimating completion time
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Calculate rate of updates as a weighted average
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * of previous and current rate
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Get enough samples before making estimate
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_left = (long)(updates_left/rate); /* time left in seconds */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "time %02d:%02d:%02d \n", hours, minutes, time_left);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unsigned int throughput = 0, rthroughput = 0, creads = 0, cwrites = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte access_s = (read_s + write_s + rmiss_s + wmiss_s);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "****** Storage Cache (Cumulative) ******");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " cd cached_partition reads writes reads writes");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rthroughput += cs_cur->st_shared[i].sh_disk_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte throughput += cs_cur->st_shared[i].sh_disk_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte strlen(cs_cur->st_shared[i].sh_filename)) > 15) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%3d %-15s%c %10u %10u %10u %10u",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "---------- ---------- ---------- ----------");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(5 + j, 8, " Kbytes total:%10u %10u %10u %10u",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(7 + j, 18, "read write %%readh %%writeh");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(8 + j, 11, "( misses) ( misses)");
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(13 + j, 1, "cachesize blocksize");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(14 + j, 1, "%8dK %10d", cs_cur->st_cachesize / 1024,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(16 + j, 1, "Write blocks available:");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(17 + j, 1, "Net 0: %6d", cs_cur->st_wlru_inq);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(19 + j, 1, "LRU stats: Blocks Requeued Optimized");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(20 + j, 7, "%12d %12u %12u", cs_cur->st_lru_blocks,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mvprintw(25 + j, 1, "* -- disk off-line");