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 */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifndef _SDBC_STATS_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define _SDBC_STATS_H
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern "C" {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Internal flags to denote data collection status
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define GOT_SET_KSTAT 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define GOT_IO_KSTAT 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define GOT_COMPLETE_SDBC (GOT_SET_KSTAT | GOT_IO_KSTAT)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SDBC_COMPLETE(x) (((x) & (GOT_COMPLETE_SDBC)) != \
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (GOT_COMPLETE_SDBC))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SDBC_KBYTES 0x01
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define SDBC_INTAVG 0x02
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define KILOBYTE 1024
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sdbcstat_s
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *pre_set;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *pre_io;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *cur_set;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte kstat_t *cur_io;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int collected;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct sdbcstat_s *next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sdbcstat_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct sdbcvals_t
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t cache_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t cache_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t total_cache;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte float cache_hit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte float read_hit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte float write_hit;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t disk_read;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t disk_write;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t total_disk;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t destaged;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t write_cancellations;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t total_reads;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t total_writes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} sdbcvals_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern kstat_t *sdbc_global;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* Prototypes */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint sdbc_discover(kstat_ctl_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint sdbc_update(kstat_ctl_t *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint sdbc_report();
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortesdbcstat_t *sdbc_getstat(char *);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint sdbc_getvalues(sdbcstat_t *, sdbcvals_t *, int);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#ifdef __cplusplus
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif /* _SDBC_STATS_H */