xref: /freebsd/include/rpcsvc/rstat.x (revision 5b31cc94b10d4bb7109c6b27940a0fc76a44a331)
1*8785398fSHiroki Sato /*-
2*8785398fSHiroki Sato  * Copyright (c) 2010, Oracle America, Inc.
375b63130SGarrett Wollman  *
4*8785398fSHiroki Sato  * Redistribution and use in source and binary forms, with or without
5*8785398fSHiroki Sato  * modification, are permitted provided that the following conditions are
6*8785398fSHiroki Sato  * met:
775b63130SGarrett Wollman  *
8*8785398fSHiroki Sato  *     * Redistributions of source code must retain the above copyright
9*8785398fSHiroki Sato  *       notice, this list of conditions and the following disclaimer.
10*8785398fSHiroki Sato  *     * Redistributions in binary form must reproduce the above
11*8785398fSHiroki Sato  *       copyright notice, this list of conditions and the following
12*8785398fSHiroki Sato  *       disclaimer in the documentation and/or other materials
13*8785398fSHiroki Sato  *       provided with the distribution.
14*8785398fSHiroki Sato  *     * Neither the name of the "Oracle America, Inc." nor the names of its
15*8785398fSHiroki Sato  *       contributors may be used to endorse or promote products derived
16*8785398fSHiroki Sato  *       from this software without specific prior written permission.
1775b63130SGarrett Wollman  *
18*8785398fSHiroki Sato  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19*8785398fSHiroki Sato  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20*8785398fSHiroki Sato  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21*8785398fSHiroki Sato  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22*8785398fSHiroki Sato  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23*8785398fSHiroki Sato  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*8785398fSHiroki Sato  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
25*8785398fSHiroki Sato  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*8785398fSHiroki Sato  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27*8785398fSHiroki Sato  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28*8785398fSHiroki Sato  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29*8785398fSHiroki Sato  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3075b63130SGarrett Wollman  */
3175b63130SGarrett Wollman 
3275b63130SGarrett Wollman /*
3375b63130SGarrett Wollman  * Gather statistics on remote machines
3475b63130SGarrett Wollman  */
3575b63130SGarrett Wollman 
3675b63130SGarrett Wollman #ifdef RPC_HDR
3775b63130SGarrett Wollman 
3875b63130SGarrett Wollman %#ifndef FSCALE
3975b63130SGarrett Wollman %/*
4075b63130SGarrett Wollman % * Scale factor for scaled integers used to count load averages.
4175b63130SGarrett Wollman % */
4275b63130SGarrett Wollman %#define FSHIFT  8               /* bits to right of fixed binary point */
4375b63130SGarrett Wollman %#define FSCALE  (1<<FSHIFT)
4475b63130SGarrett Wollman %
4575b63130SGarrett Wollman %#endif /* ndef FSCALE */
4675b63130SGarrett Wollman 
4775b63130SGarrett Wollman #endif /* def RPC_HDR */
4875b63130SGarrett Wollman 
4975b63130SGarrett Wollman const RSTAT_CPUSTATES = 4;
5075b63130SGarrett Wollman const RSTAT_DK_NDRIVE = 4;
5175b63130SGarrett Wollman 
5275b63130SGarrett Wollman /*
5375b63130SGarrett Wollman  * GMT since 0:00, January 1, 1970
5475b63130SGarrett Wollman  */
5575b63130SGarrett Wollman struct rstat_timeval {
5675b63130SGarrett Wollman 	unsigned int tv_sec;	/* seconds */
5775b63130SGarrett Wollman 	unsigned int tv_usec;	/* and microseconds */
5875b63130SGarrett Wollman };
5975b63130SGarrett Wollman 
6075b63130SGarrett Wollman struct statstime {				/* RSTATVERS_TIME */
6175b63130SGarrett Wollman 	int cp_time[RSTAT_CPUSTATES];
6275b63130SGarrett Wollman 	int dk_xfer[RSTAT_DK_NDRIVE];
6375b63130SGarrett Wollman 	unsigned int v_pgpgin;	/* these are cumulative sum */
6475b63130SGarrett Wollman 	unsigned int v_pgpgout;
6575b63130SGarrett Wollman 	unsigned int v_pswpin;
6675b63130SGarrett Wollman 	unsigned int v_pswpout;
6775b63130SGarrett Wollman 	unsigned int v_intr;
6875b63130SGarrett Wollman 	int if_ipackets;
6975b63130SGarrett Wollman 	int if_ierrors;
7075b63130SGarrett Wollman 	int if_oerrors;
7175b63130SGarrett Wollman 	int if_collisions;
7275b63130SGarrett Wollman 	unsigned int v_swtch;
7375b63130SGarrett Wollman 	int avenrun[3];         /* scaled by FSCALE */
7475b63130SGarrett Wollman 	rstat_timeval boottime;
7575b63130SGarrett Wollman 	rstat_timeval curtime;
7675b63130SGarrett Wollman 	int if_opackets;
7775b63130SGarrett Wollman };
7875b63130SGarrett Wollman 
7975b63130SGarrett Wollman struct statsswtch {			/* RSTATVERS_SWTCH */
8075b63130SGarrett Wollman 	int cp_time[RSTAT_CPUSTATES];
8175b63130SGarrett Wollman 	int dk_xfer[RSTAT_DK_NDRIVE];
8275b63130SGarrett Wollman 	unsigned int v_pgpgin;	/* these are cumulative sum */
8375b63130SGarrett Wollman 	unsigned int v_pgpgout;
8475b63130SGarrett Wollman 	unsigned int v_pswpin;
8575b63130SGarrett Wollman 	unsigned int v_pswpout;
8675b63130SGarrett Wollman 	unsigned int v_intr;
8775b63130SGarrett Wollman 	int if_ipackets;
8875b63130SGarrett Wollman 	int if_ierrors;
8975b63130SGarrett Wollman 	int if_oerrors;
9075b63130SGarrett Wollman 	int if_collisions;
9175b63130SGarrett Wollman 	unsigned int v_swtch;
9275b63130SGarrett Wollman 	unsigned int avenrun[3];/* scaled by FSCALE */
9375b63130SGarrett Wollman 	rstat_timeval boottime;
9475b63130SGarrett Wollman 	int if_opackets;
9575b63130SGarrett Wollman };
9675b63130SGarrett Wollman 
9775b63130SGarrett Wollman struct stats {				/* RSTATVERS_ORIG */
9875b63130SGarrett Wollman 	int cp_time[RSTAT_CPUSTATES];
9975b63130SGarrett Wollman 	int dk_xfer[RSTAT_DK_NDRIVE];
10075b63130SGarrett Wollman 	unsigned int v_pgpgin;	/* these are cumulative sum */
10175b63130SGarrett Wollman 	unsigned int v_pgpgout;
10275b63130SGarrett Wollman 	unsigned int v_pswpin;
10375b63130SGarrett Wollman 	unsigned int v_pswpout;
10475b63130SGarrett Wollman 	unsigned int v_intr;
10575b63130SGarrett Wollman 	int if_ipackets;
10675b63130SGarrett Wollman 	int if_ierrors;
10775b63130SGarrett Wollman 	int if_oerrors;
10875b63130SGarrett Wollman 	int if_collisions;
10975b63130SGarrett Wollman 	int if_opackets;
11075b63130SGarrett Wollman };
11175b63130SGarrett Wollman 
11275b63130SGarrett Wollman 
11375b63130SGarrett Wollman program RSTATPROG {
11475b63130SGarrett Wollman 	/*
11575b63130SGarrett Wollman 	 * Newest version includes current time and context switching info
11675b63130SGarrett Wollman 	 */
11775b63130SGarrett Wollman 	version RSTATVERS_TIME {
11875b63130SGarrett Wollman 		statstime
11975b63130SGarrett Wollman 		RSTATPROC_STATS(void) = 1;
12075b63130SGarrett Wollman 
12175b63130SGarrett Wollman 		unsigned int
12275b63130SGarrett Wollman 		RSTATPROC_HAVEDISK(void) = 2;
12375b63130SGarrett Wollman 	} = 3;
12475b63130SGarrett Wollman 	/*
12575b63130SGarrett Wollman 	 * Does not have current time
12675b63130SGarrett Wollman 	 */
12775b63130SGarrett Wollman 	version RSTATVERS_SWTCH {
12875b63130SGarrett Wollman 		statsswtch
12975b63130SGarrett Wollman 		RSTATPROC_STATS(void) = 1;
13075b63130SGarrett Wollman 
13175b63130SGarrett Wollman 		unsigned int
13275b63130SGarrett Wollman 		RSTATPROC_HAVEDISK(void) = 2;
13375b63130SGarrett Wollman 	} = 2;
13475b63130SGarrett Wollman 	/*
13575b63130SGarrett Wollman 	 * Old version has no info about current time or context switching
13675b63130SGarrett Wollman 	 */
13775b63130SGarrett Wollman 	version RSTATVERS_ORIG {
13875b63130SGarrett Wollman 		stats
13975b63130SGarrett Wollman 		RSTATPROC_STATS(void) = 1;
14075b63130SGarrett Wollman 
14175b63130SGarrett Wollman 		unsigned int
14275b63130SGarrett Wollman 		RSTATPROC_HAVEDISK(void) = 2;
14375b63130SGarrett Wollman 	} = 1;
14475b63130SGarrett Wollman } = 100001;
1450c96d7c6SAlfred Perlstein 
1460c96d7c6SAlfred Perlstein #ifdef RPC_HDR
1470c96d7c6SAlfred Perlstein %
1480c96d7c6SAlfred Perlstein %enum clnt_stat rstat(char *, struct statstime *);
1490c96d7c6SAlfred Perlstein %int havedisk(char *);
1500c96d7c6SAlfred Perlstein %
1510c96d7c6SAlfred Perlstein #endif
152