xref: /freebsd/include/rpcsvc/rstat.x (revision f11c7f63056671247335df83a3fe80b94c6616ac)
1 /*
2  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
3  * unrestricted use provided that this legend is included on all tape
4  * media and as a part of the software program in whole or part.  Users
5  * may copy or modify Sun RPC without charge, but are not authorized
6  * to license or distribute it to anyone else except as part of a product or
7  * program developed by the user.
8  *
9  * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
10  * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
11  * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
12  *
13  * Sun RPC is provided with no support and without any obligation on the
14  * part of Sun Microsystems, Inc. to assist in its use, correction,
15  * modification or enhancement.
16  *
17  * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
18  * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
19  * OR ANY PART THEREOF.
20  *
21  * In no event will Sun Microsystems, Inc. be liable for any lost revenue
22  * or profits or other special, indirect and consequential damages, even if
23  * Sun has been advised of the possibility of such damages.
24  *
25  * Sun Microsystems, Inc.
26  * 2550 Garcia Avenue
27  * Mountain View, California  94043
28  */
29 
30 /*
31  * Gather statistics on remote machines
32  */
33 
34 #ifdef RPC_HDR
35 
36 %#ifndef FSCALE
37 %/*
38 % * Scale factor for scaled integers used to count load averages.
39 % */
40 %#define FSHIFT  8               /* bits to right of fixed binary point */
41 %#define FSCALE  (1<<FSHIFT)
42 %
43 %#endif /* ndef FSCALE */
44 
45 #else
46 
47 %#ifndef lint
48 %/*static char sccsid[] = "from: @(#)rstat.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/
49 %/*static char sccsid[] = "from: @(#)rstat.x	2.2 88/08/01 4.0 RPCSRC";*/
50 %#endif /* not lint */
51 %#include <sys/cdefs.h>
52 %__FBSDID("$FreeBSD$");
53 
54 #endif /* def RPC_HDR */
55 
56 const RSTAT_CPUSTATES = 4;
57 const RSTAT_DK_NDRIVE = 4;
58 
59 /*
60  * GMT since 0:00, January 1, 1970
61  */
62 struct rstat_timeval {
63 	unsigned int tv_sec;	/* seconds */
64 	unsigned int tv_usec;	/* and microseconds */
65 };
66 
67 struct statstime {				/* RSTATVERS_TIME */
68 	int cp_time[RSTAT_CPUSTATES];
69 	int dk_xfer[RSTAT_DK_NDRIVE];
70 	unsigned int v_pgpgin;	/* these are cumulative sum */
71 	unsigned int v_pgpgout;
72 	unsigned int v_pswpin;
73 	unsigned int v_pswpout;
74 	unsigned int v_intr;
75 	int if_ipackets;
76 	int if_ierrors;
77 	int if_oerrors;
78 	int if_collisions;
79 	unsigned int v_swtch;
80 	int avenrun[3];         /* scaled by FSCALE */
81 	rstat_timeval boottime;
82 	rstat_timeval curtime;
83 	int if_opackets;
84 };
85 
86 struct statsswtch {			/* RSTATVERS_SWTCH */
87 	int cp_time[RSTAT_CPUSTATES];
88 	int dk_xfer[RSTAT_DK_NDRIVE];
89 	unsigned int v_pgpgin;	/* these are cumulative sum */
90 	unsigned int v_pgpgout;
91 	unsigned int v_pswpin;
92 	unsigned int v_pswpout;
93 	unsigned int v_intr;
94 	int if_ipackets;
95 	int if_ierrors;
96 	int if_oerrors;
97 	int if_collisions;
98 	unsigned int v_swtch;
99 	unsigned int avenrun[3];/* scaled by FSCALE */
100 	rstat_timeval boottime;
101 	int if_opackets;
102 };
103 
104 struct stats {				/* RSTATVERS_ORIG */
105 	int cp_time[RSTAT_CPUSTATES];
106 	int dk_xfer[RSTAT_DK_NDRIVE];
107 	unsigned int v_pgpgin;	/* these are cumulative sum */
108 	unsigned int v_pgpgout;
109 	unsigned int v_pswpin;
110 	unsigned int v_pswpout;
111 	unsigned int v_intr;
112 	int if_ipackets;
113 	int if_ierrors;
114 	int if_oerrors;
115 	int if_collisions;
116 	int if_opackets;
117 };
118 
119 
120 program RSTATPROG {
121 	/*
122 	 * Newest version includes current time and context switching info
123 	 */
124 	version RSTATVERS_TIME {
125 		statstime
126 		RSTATPROC_STATS(void) = 1;
127 
128 		unsigned int
129 		RSTATPROC_HAVEDISK(void) = 2;
130 	} = 3;
131 	/*
132 	 * Does not have current time
133 	 */
134 	version RSTATVERS_SWTCH {
135 		statsswtch
136 		RSTATPROC_STATS(void) = 1;
137 
138 		unsigned int
139 		RSTATPROC_HAVEDISK(void) = 2;
140 	} = 2;
141 	/*
142 	 * Old version has no info about current time or context switching
143 	 */
144 	version RSTATVERS_ORIG {
145 		stats
146 		RSTATPROC_STATS(void) = 1;
147 
148 		unsigned int
149 		RSTATPROC_HAVEDISK(void) = 2;
150 	} = 1;
151 } = 100001;
152 
153 #ifdef RPC_HDR
154 %
155 %enum clnt_stat rstat(char *, struct statstime *);
156 %int havedisk(char *);
157 %
158 #endif
159