17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5a08731ecScth  * Common Development and Distribution License (the "License").
6a08731ecScth  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
2244c4f64bSJohn Levon  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
23*1f9f06cfSMatthew Ahrens  * Copyright (c) 2012 by Delphix. All rights reserved.
24*1f9f06cfSMatthew Ahrens  */
25*1f9f06cfSMatthew Ahrens 
26*1f9f06cfSMatthew Ahrens /*
277c478bd9Sstevel@tonic-gate  * Common routines for acquiring snapshots of kstats for
287c478bd9Sstevel@tonic-gate  * iostat, mpstat, and vmstat.
297c478bd9Sstevel@tonic-gate  */
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifndef	_STATCOMMON_H
327c478bd9Sstevel@tonic-gate #define	_STATCOMMON_H
337c478bd9Sstevel@tonic-gate 
347c478bd9Sstevel@tonic-gate #ifdef __cplusplus
357c478bd9Sstevel@tonic-gate extern "C" {
367c478bd9Sstevel@tonic-gate #endif
377c478bd9Sstevel@tonic-gate 
387c478bd9Sstevel@tonic-gate #include <stdio.h>
397c478bd9Sstevel@tonic-gate #include <kstat.h>
407c478bd9Sstevel@tonic-gate #include <sys/time.h>
417c478bd9Sstevel@tonic-gate #include <sys/types.h>
427c478bd9Sstevel@tonic-gate #include <sys/buf.h>
437c478bd9Sstevel@tonic-gate #include <sys/dnlc.h>
447c478bd9Sstevel@tonic-gate #include <sys/sysinfo.h>
457c478bd9Sstevel@tonic-gate #include <sys/processor.h>
467c478bd9Sstevel@tonic-gate #include <sys/pset.h>
474be70790Swroche #include <sys/avl.h>
487c478bd9Sstevel@tonic-gate 
497c478bd9Sstevel@tonic-gate /* No CPU present at this CPU position */
507c478bd9Sstevel@tonic-gate #define	ID_NO_CPU -1
517c478bd9Sstevel@tonic-gate /* CPU belongs to no pset (we number this as "pset 0")  */
527c478bd9Sstevel@tonic-gate #define	ID_NO_PSET 0
537c478bd9Sstevel@tonic-gate /* CPU is usable */
547c478bd9Sstevel@tonic-gate #define	CPU_ONLINE(s) ((s) == P_ONLINE || (s) == P_NOINTR)
557c478bd9Sstevel@tonic-gate /* will the CPU have kstats */
567c478bd9Sstevel@tonic-gate #define	CPU_ACTIVE(c) (CPU_ONLINE((c)->cs_state) && (c)->cs_id != ID_NO_CPU)
577c478bd9Sstevel@tonic-gate /* IO device has no identified ID */
587c478bd9Sstevel@tonic-gate #define	IODEV_NO_ID -1
597c478bd9Sstevel@tonic-gate /* no limit to iodevs to collect */
607c478bd9Sstevel@tonic-gate #define	UNLIMITED_IODEVS ((size_t)-1)
617c478bd9Sstevel@tonic-gate 
624944376cSJohn Levon #define	NODATE	0	/* Default:  No time stamp */
634944376cSJohn Levon #define	DDATE	1	/* Standard date format */
644944376cSJohn Levon #define	UDATE	2	/* Internal representation of Unix time */
654944376cSJohn Levon 
664944376cSJohn Levon 
677c478bd9Sstevel@tonic-gate enum snapshot_types {
687c478bd9Sstevel@tonic-gate 	/* All CPUs separately */
697c478bd9Sstevel@tonic-gate 	SNAP_CPUS 		= 1 << 0,
707c478bd9Sstevel@tonic-gate 	/* Aggregated processor sets */
717c478bd9Sstevel@tonic-gate 	SNAP_PSETS		= 1 << 1,
727c478bd9Sstevel@tonic-gate 	/* sys-wide stats including aggregated CPU stats */
737c478bd9Sstevel@tonic-gate 	SNAP_SYSTEM		= 1 << 2,
747c478bd9Sstevel@tonic-gate 	/* interrupt sources and counts */
757c478bd9Sstevel@tonic-gate 	SNAP_INTERRUPTS 	= 1 << 3,
767c478bd9Sstevel@tonic-gate 	/* disk etc. stats */
7744c4f64bSJohn Levon 	SNAP_IODEVS		= 1 << 4,
787c478bd9Sstevel@tonic-gate 	/* disk controller aggregates */
7944c4f64bSJohn Levon 	SNAP_CONTROLLERS	= 1 << 5,
8037fbbce5Scth 	/* mpxio L I (multipath) paths: -X: Lun,LunInitiator */
8144c4f64bSJohn Levon 	SNAP_IOPATHS_LI		= 1 << 6,
8237fbbce5Scth 	/* mpxio LTI (multipath) paths: -Y: Lun,LunTarget,LunTargetInitiator */
8344c4f64bSJohn Levon 	SNAP_IOPATHS_LTI	= 1 << 7,
847c478bd9Sstevel@tonic-gate 	/* disk error stats */
8544c4f64bSJohn Levon 	SNAP_IODEV_ERRORS	= 1 << 8,
867c478bd9Sstevel@tonic-gate 	/* pretty names for iodevs */
8744c4f64bSJohn Levon 	SNAP_IODEV_PRETTY	= 1 << 9,
88a08731ecScth 	/* devid for iodevs */
8944c4f64bSJohn Levon 	SNAP_IODEV_DEVID	= 1 << 10
907c478bd9Sstevel@tonic-gate };
917c478bd9Sstevel@tonic-gate 
927c478bd9Sstevel@tonic-gate struct cpu_snapshot {
937c478bd9Sstevel@tonic-gate 	/* may be ID_NO_CPU if no CPU present */
947c478bd9Sstevel@tonic-gate 	processorid_t cs_id;
957c478bd9Sstevel@tonic-gate 	/* may be ID_NO_PSET if no pset */
967c478bd9Sstevel@tonic-gate 	psetid_t cs_pset_id;
977c478bd9Sstevel@tonic-gate 	/* as in p_online(2) */
987c478bd9Sstevel@tonic-gate 	int cs_state;
997c478bd9Sstevel@tonic-gate 	/* stats for this CPU */
1007c478bd9Sstevel@tonic-gate 	kstat_t cs_vm;
1017c478bd9Sstevel@tonic-gate 	kstat_t cs_sys;
1027c478bd9Sstevel@tonic-gate };
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate struct pset_snapshot {
1057c478bd9Sstevel@tonic-gate 	/* ID may be zero to indicate the "none set" */
1067c478bd9Sstevel@tonic-gate 	psetid_t ps_id;
1077c478bd9Sstevel@tonic-gate 	/* number of CPUs in set */
1087c478bd9Sstevel@tonic-gate 	size_t ps_nr_cpus;
1097c478bd9Sstevel@tonic-gate 	/* the CPUs in this set */
1107c478bd9Sstevel@tonic-gate 	struct cpu_snapshot **ps_cpus;
1117c478bd9Sstevel@tonic-gate };
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate struct intr_snapshot {
1147c478bd9Sstevel@tonic-gate 	/* name of interrupt source */
1157c478bd9Sstevel@tonic-gate 	char is_name[KSTAT_STRLEN];
1167c478bd9Sstevel@tonic-gate 	/* total number of interrupts from this source */
1177c478bd9Sstevel@tonic-gate 	ulong_t is_total;
1187c478bd9Sstevel@tonic-gate };
1197c478bd9Sstevel@tonic-gate 
1207c478bd9Sstevel@tonic-gate struct sys_snapshot {
1217c478bd9Sstevel@tonic-gate 	sysinfo_t ss_sysinfo;
1227c478bd9Sstevel@tonic-gate 	vminfo_t ss_vminfo;
1237c478bd9Sstevel@tonic-gate 	struct nc_stats ss_nc;
1247c478bd9Sstevel@tonic-gate 	/* vm/sys stats aggregated across all CPUs */
1257c478bd9Sstevel@tonic-gate 	kstat_t ss_agg_vm;
1267c478bd9Sstevel@tonic-gate 	kstat_t ss_agg_sys;
1277c478bd9Sstevel@tonic-gate 	/* ticks since boot */
1287c478bd9Sstevel@tonic-gate 	ulong_t ss_ticks;
1297c478bd9Sstevel@tonic-gate 	long ss_deficit;
1307c478bd9Sstevel@tonic-gate };
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate /* order is significant (see sort_before()) */
1337c478bd9Sstevel@tonic-gate enum iodev_type {
1347c478bd9Sstevel@tonic-gate 	IODEV_CONTROLLER	= 1 << 0,
1357c478bd9Sstevel@tonic-gate 	IODEV_DISK		= 1 << 1,
1367c478bd9Sstevel@tonic-gate 	IODEV_PARTITION		= 1 << 2,
1377c478bd9Sstevel@tonic-gate 	IODEV_TAPE		= 1 << 3,
1387c478bd9Sstevel@tonic-gate 	IODEV_NFS		= 1 << 4,
13937fbbce5Scth 	IODEV_IOPATH_LT		= 1 << 5,	/* synthetic LunTarget */
14037fbbce5Scth 	IODEV_IOPATH_LI		= 1 << 6,	/* synthetic LunInitiator */
14137fbbce5Scth 	IODEV_IOPATH_LTI	= 1 << 7,	/* LunTgtInitiator (pathinfo) */
14237fbbce5Scth 	IODEV_UNKNOWN		= 1 << 8
1437c478bd9Sstevel@tonic-gate };
1447c478bd9Sstevel@tonic-gate 
1457c478bd9Sstevel@tonic-gate /* identify a disk, partition, etc. */
1467c478bd9Sstevel@tonic-gate struct iodev_id {
1477c478bd9Sstevel@tonic-gate 	int id;
1487c478bd9Sstevel@tonic-gate 	/* target id (for disks) */
1497c478bd9Sstevel@tonic-gate 	char tid[KSTAT_STRLEN];
1507c478bd9Sstevel@tonic-gate };
1517c478bd9Sstevel@tonic-gate 
1527c478bd9Sstevel@tonic-gate /*
1537c478bd9Sstevel@tonic-gate  * Used for disks, partitions, tapes, nfs, controllers, iopaths
1547c478bd9Sstevel@tonic-gate  * Each entry can be a branch of a tree; for example, the disks
1557c478bd9Sstevel@tonic-gate  * of a controller constitute the children of the controller
1567c478bd9Sstevel@tonic-gate  * iodev_snapshot. This relationship is not strictly maintained
1577c478bd9Sstevel@tonic-gate  * if is_pretty can't be found.
1587c478bd9Sstevel@tonic-gate  */
1597c478bd9Sstevel@tonic-gate struct iodev_snapshot {
1607c478bd9Sstevel@tonic-gate 	/* original kstat name */
1617c478bd9Sstevel@tonic-gate 	char is_name[KSTAT_STRLEN];
16237fbbce5Scth 	/* type of kstat */
1637c478bd9Sstevel@tonic-gate 	enum iodev_type is_type;
1647c478bd9Sstevel@tonic-gate 	/* ID if meaningful */
1657c478bd9Sstevel@tonic-gate 	struct iodev_id is_id;
1667c478bd9Sstevel@tonic-gate 	/* parent ID if meaningful */
1677c478bd9Sstevel@tonic-gate 	struct iodev_id is_parent_id;
1687c478bd9Sstevel@tonic-gate 	/* user-friendly name if found */
1697c478bd9Sstevel@tonic-gate 	char *is_pretty;
1707c478bd9Sstevel@tonic-gate 	/* device ID if applicable */
1717c478bd9Sstevel@tonic-gate 	char *is_devid;
1727c478bd9Sstevel@tonic-gate 	/* mount-point if applicable */
1737c478bd9Sstevel@tonic-gate 	char *is_dname;
1747c478bd9Sstevel@tonic-gate 	/* number of direct children */
1757c478bd9Sstevel@tonic-gate 	int is_nr_children;
1767c478bd9Sstevel@tonic-gate 	/* children of this I/O device */
1777c478bd9Sstevel@tonic-gate 	struct iodev_snapshot *is_children;
1787c478bd9Sstevel@tonic-gate 	/* standard I/O stats */
1797c478bd9Sstevel@tonic-gate 	kstat_io_t is_stats;
1807c478bd9Sstevel@tonic-gate 	/* iodev error stats */
1817c478bd9Sstevel@tonic-gate 	kstat_t is_errors;
1827c478bd9Sstevel@tonic-gate 	/* creation time of the stats */
1837c478bd9Sstevel@tonic-gate 	hrtime_t is_crtime;
1847c478bd9Sstevel@tonic-gate 	/* time at which iodev snapshot was taken */
1857c478bd9Sstevel@tonic-gate 	hrtime_t is_snaptime;
1867c478bd9Sstevel@tonic-gate 	/* kstat module */
1877c478bd9Sstevel@tonic-gate 	char is_module[KSTAT_STRLEN];
1887c478bd9Sstevel@tonic-gate 	/* kstat instance */
1897c478bd9Sstevel@tonic-gate 	int is_instance;
1907c478bd9Sstevel@tonic-gate 	/* kstat (only used temporarily) */
1917c478bd9Sstevel@tonic-gate 	kstat_t *is_ksp;
1927c478bd9Sstevel@tonic-gate 	struct iodev_snapshot *is_prev;
1937c478bd9Sstevel@tonic-gate 	struct iodev_snapshot *is_next;
1944be70790Swroche 	/* AVL structures to speedup insertion */
1954be70790Swroche 	avl_tree_t *avl_list;	/* list this element belongs to */
1964be70790Swroche 	avl_node_t avl_link;
1977c478bd9Sstevel@tonic-gate };
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate /* which iodevs to show. */
2007c478bd9Sstevel@tonic-gate struct iodev_filter {
2017c478bd9Sstevel@tonic-gate 	/* nr. of iodevs to choose */
2027c478bd9Sstevel@tonic-gate 	size_t if_max_iodevs;
2037c478bd9Sstevel@tonic-gate 	/* bit mask of enum io_types to allow */
2047c478bd9Sstevel@tonic-gate 	int if_allowed_types;
2057c478bd9Sstevel@tonic-gate 	/* should we show floppy ? if_names can override this */
2067c478bd9Sstevel@tonic-gate 	int if_skip_floppy;
2077c478bd9Sstevel@tonic-gate 	/* nr. of named iodevs */
2087c478bd9Sstevel@tonic-gate 	size_t if_nr_names;
2097c478bd9Sstevel@tonic-gate 	char **if_names;
2107c478bd9Sstevel@tonic-gate };
2117c478bd9Sstevel@tonic-gate 
2127c478bd9Sstevel@tonic-gate /* The primary structure of a system snapshot. */
2137c478bd9Sstevel@tonic-gate struct snapshot {
2147c478bd9Sstevel@tonic-gate 	/* what types were *requested* */
2157c478bd9Sstevel@tonic-gate 	enum snapshot_types s_types;
2167c478bd9Sstevel@tonic-gate 	size_t s_nr_cpus;
2177c478bd9Sstevel@tonic-gate 	struct cpu_snapshot *s_cpus;
2187c478bd9Sstevel@tonic-gate 	size_t s_nr_psets;
2197c478bd9Sstevel@tonic-gate 	struct pset_snapshot *s_psets;
2207c478bd9Sstevel@tonic-gate 	size_t s_nr_intrs;
2217c478bd9Sstevel@tonic-gate 	struct intr_snapshot *s_intrs;
2227c478bd9Sstevel@tonic-gate 	size_t s_nr_iodevs;
2237c478bd9Sstevel@tonic-gate 	struct iodev_snapshot *s_iodevs;
22437fbbce5Scth 	size_t s_iodevs_is_name_maxlen;
2257c478bd9Sstevel@tonic-gate 	struct sys_snapshot s_sys;
2267c478bd9Sstevel@tonic-gate 	struct biostats s_biostats;
227*1f9f06cfSMatthew Ahrens 	size_t s_nr_active_cpus;
2287c478bd9Sstevel@tonic-gate };
2297c478bd9Sstevel@tonic-gate 
2307c478bd9Sstevel@tonic-gate /* print a message and exit with failure */
2317c478bd9Sstevel@tonic-gate void fail(int do_perror, char *message, ...);
2327c478bd9Sstevel@tonic-gate 
2337c478bd9Sstevel@tonic-gate /* strdup str, or exit with failure */
2347c478bd9Sstevel@tonic-gate char *safe_strdup(char *str);
2357c478bd9Sstevel@tonic-gate 
2367c478bd9Sstevel@tonic-gate /* malloc successfully, or exit with failure */
2377c478bd9Sstevel@tonic-gate void *safe_alloc(size_t size);
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate /*
2407c478bd9Sstevel@tonic-gate  * Copy a kstat from src to dst. If the source kstat contains no data,
2417c478bd9Sstevel@tonic-gate  * then set the destination kstat data to NULL and size to zero.
2427c478bd9Sstevel@tonic-gate  * Returns 0 on success.
2437c478bd9Sstevel@tonic-gate  */
2447c478bd9Sstevel@tonic-gate int kstat_copy(const kstat_t *src, kstat_t *dst);
2457c478bd9Sstevel@tonic-gate 
2467c478bd9Sstevel@tonic-gate /*
2477c478bd9Sstevel@tonic-gate  * Look up the named kstat, and give the ui64 difference i.e.
2487c478bd9Sstevel@tonic-gate  * new - old, or if old is NULL, return new.
2497c478bd9Sstevel@tonic-gate  */
2507c478bd9Sstevel@tonic-gate uint64_t kstat_delta(kstat_t *old, kstat_t *new, char *name);
2517c478bd9Sstevel@tonic-gate 
25237fbbce5Scth /* Return the number of ticks delta between two hrtime_t values. */
25337fbbce5Scth uint64_t hrtime_delta(hrtime_t old, hrtime_t new);
25437fbbce5Scth 
2557c478bd9Sstevel@tonic-gate /*
2567c478bd9Sstevel@tonic-gate  * Add the integer-valued stats from "src" to the
2577c478bd9Sstevel@tonic-gate  * existing ones in "dst". If "dst" does not contain
2587c478bd9Sstevel@tonic-gate  * stats, then a kstat_copy() is performed.
2597c478bd9Sstevel@tonic-gate  */
2607c478bd9Sstevel@tonic-gate int kstat_add(const kstat_t *src, kstat_t *dst);
2617c478bd9Sstevel@tonic-gate 
2627c478bd9Sstevel@tonic-gate /* return the number of CPUs with kstats (i.e. present and online) */
2637c478bd9Sstevel@tonic-gate int nr_active_cpus(struct snapshot *ss);
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate /*
2667c478bd9Sstevel@tonic-gate  * Return the difference in CPU ticks between the two sys
2677c478bd9Sstevel@tonic-gate  * kstats.
2687c478bd9Sstevel@tonic-gate  */
2697c478bd9Sstevel@tonic-gate uint64_t cpu_ticks_delta(kstat_t *old, kstat_t *new);
2707c478bd9Sstevel@tonic-gate 
2717c478bd9Sstevel@tonic-gate /*
2727c478bd9Sstevel@tonic-gate  * Open the kstat chain. Cannot fail.
2737c478bd9Sstevel@tonic-gate  */
2747c478bd9Sstevel@tonic-gate kstat_ctl_t *open_kstat(void);
2757c478bd9Sstevel@tonic-gate 
2767c478bd9Sstevel@tonic-gate /*
2777c478bd9Sstevel@tonic-gate  * Return a struct snapshot based on the snapshot_types parameter
2787c478bd9Sstevel@tonic-gate  * passed in. iodev_filter may be NULL in which case all iodevs
2797c478bd9Sstevel@tonic-gate  * are selected if SNAP_IODEVS is passed.
2807c478bd9Sstevel@tonic-gate  */
2817c478bd9Sstevel@tonic-gate struct snapshot *acquire_snapshot(kstat_ctl_t *, int, struct iodev_filter *);
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate /* free a snapshot */
2847c478bd9Sstevel@tonic-gate void free_snapshot(struct snapshot *ss);
2857c478bd9Sstevel@tonic-gate 
2867c478bd9Sstevel@tonic-gate typedef void (*snapshot_cb)(void *old, void *new, void *data);
2877c478bd9Sstevel@tonic-gate 
2887c478bd9Sstevel@tonic-gate /*
2897c478bd9Sstevel@tonic-gate  * Call the call back for each pair of data items of the given type,
2907c478bd9Sstevel@tonic-gate  * passing the data pointer passed in as well. If an item has been
2917c478bd9Sstevel@tonic-gate  * added, the first pointer will be NULL; if removed, the second pointer
2927c478bd9Sstevel@tonic-gate  * will be NULL.
2937c478bd9Sstevel@tonic-gate  *
2947c478bd9Sstevel@tonic-gate  * A non-zero return value indicates configuration has changed.
2957c478bd9Sstevel@tonic-gate  */
2967c478bd9Sstevel@tonic-gate int snapshot_walk(enum snapshot_types type, struct snapshot *old,
2977c478bd9Sstevel@tonic-gate     struct snapshot *new, snapshot_cb cb, void *data);
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate /*
3007c478bd9Sstevel@tonic-gate  * Output a line detailing any configuration changes such as a CPU
3017c478bd9Sstevel@tonic-gate  * brought online, etc, bracketed by << >>.
3027c478bd9Sstevel@tonic-gate  */
3037c478bd9Sstevel@tonic-gate void snapshot_report_changes(struct snapshot *old, struct snapshot *new);
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate /* Return non-zero if configuration has changed. */
3067c478bd9Sstevel@tonic-gate int snapshot_has_changed(struct snapshot *old, struct snapshot *new);
3077c478bd9Sstevel@tonic-gate 
3087c478bd9Sstevel@tonic-gate /* free the given iodev */
3097c478bd9Sstevel@tonic-gate void free_iodev(struct iodev_snapshot *iodev);
3107c478bd9Sstevel@tonic-gate 
3117c478bd9Sstevel@tonic-gate /* acquire the I/O devices */
3127c478bd9Sstevel@tonic-gate int acquire_iodevs(struct snapshot *ss, kstat_ctl_t *kc,
3137c478bd9Sstevel@tonic-gate     struct iodev_filter *df);
3147c478bd9Sstevel@tonic-gate 
3157c478bd9Sstevel@tonic-gate /* strcmp-style I/O device comparator */
3167c478bd9Sstevel@tonic-gate int iodev_cmp(struct iodev_snapshot *io1, struct iodev_snapshot *io2);
3177c478bd9Sstevel@tonic-gate 
31800c76d6fStc /* sleep until *wakeup + interval, keeping cadence where desired */
31900c76d6fStc void sleep_until(hrtime_t *wakeup, hrtime_t interval, int forever,
32000c76d6fStc     int *caught_cont);
32100c76d6fStc 
32200c76d6fStc /* signal handler - so we can be aware of SIGCONT */
32300c76d6fStc void cont_handler(int sig_number);
32400c76d6fStc 
3254944376cSJohn Levon /* Print a timestamp in either Unix or standard format. */
32626fd7700SKrishnendu Sadhukhan - Sun Microsystems void print_timestamp(uint_t);
3274944376cSJohn Levon 
3287c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3297c478bd9Sstevel@tonic-gate }
3307c478bd9Sstevel@tonic-gate #endif
3317c478bd9Sstevel@tonic-gate 
3327c478bd9Sstevel@tonic-gate #endif /* _STATCOMMON_H */
333