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 %static char rcsid[] = "$Id: rstat.x,v 1.3 1993/11/30 20:31:41 ats Exp $"; 51 %#endif /* not lint */ 52 53 #endif /* def RPC_HDR */ 54 55 const RSTAT_CPUSTATES = 4; 56 const RSTAT_DK_NDRIVE = 4; 57 58 /* 59 * GMT since 0:00, January 1, 1970 60 */ 61 struct rstat_timeval { 62 unsigned int tv_sec; /* seconds */ 63 unsigned int tv_usec; /* and microseconds */ 64 }; 65 66 struct statstime { /* RSTATVERS_TIME */ 67 int cp_time[RSTAT_CPUSTATES]; 68 int dk_xfer[RSTAT_DK_NDRIVE]; 69 unsigned int v_pgpgin; /* these are cumulative sum */ 70 unsigned int v_pgpgout; 71 unsigned int v_pswpin; 72 unsigned int v_pswpout; 73 unsigned int v_intr; 74 int if_ipackets; 75 int if_ierrors; 76 int if_oerrors; 77 int if_collisions; 78 unsigned int v_swtch; 79 int avenrun[3]; /* scaled by FSCALE */ 80 rstat_timeval boottime; 81 rstat_timeval curtime; 82 int if_opackets; 83 }; 84 85 struct statsswtch { /* RSTATVERS_SWTCH */ 86 int cp_time[RSTAT_CPUSTATES]; 87 int dk_xfer[RSTAT_DK_NDRIVE]; 88 unsigned int v_pgpgin; /* these are cumulative sum */ 89 unsigned int v_pgpgout; 90 unsigned int v_pswpin; 91 unsigned int v_pswpout; 92 unsigned int v_intr; 93 int if_ipackets; 94 int if_ierrors; 95 int if_oerrors; 96 int if_collisions; 97 unsigned int v_swtch; 98 unsigned int avenrun[3];/* scaled by FSCALE */ 99 rstat_timeval boottime; 100 int if_opackets; 101 }; 102 103 struct stats { /* RSTATVERS_ORIG */ 104 int cp_time[RSTAT_CPUSTATES]; 105 int dk_xfer[RSTAT_DK_NDRIVE]; 106 unsigned int v_pgpgin; /* these are cumulative sum */ 107 unsigned int v_pgpgout; 108 unsigned int v_pswpin; 109 unsigned int v_pswpout; 110 unsigned int v_intr; 111 int if_ipackets; 112 int if_ierrors; 113 int if_oerrors; 114 int if_collisions; 115 int if_opackets; 116 }; 117 118 119 program RSTATPROG { 120 /* 121 * Newest version includes current time and context switching info 122 */ 123 version RSTATVERS_TIME { 124 statstime 125 RSTATPROC_STATS(void) = 1; 126 127 unsigned int 128 RSTATPROC_HAVEDISK(void) = 2; 129 } = 3; 130 /* 131 * Does not have current time 132 */ 133 version RSTATVERS_SWTCH { 134 statsswtch 135 RSTATPROC_STATS(void) = 1; 136 137 unsigned int 138 RSTATPROC_HAVEDISK(void) = 2; 139 } = 2; 140 /* 141 * Old version has no info about current time or context switching 142 */ 143 version RSTATVERS_ORIG { 144 stats 145 RSTATPROC_STATS(void) = 1; 146 147 unsigned int 148 RSTATPROC_HAVEDISK(void) = 2; 149 } = 1; 150 } = 100001; 151