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