Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


rstat.x
001: /* @(#)rstat.x  2.2 88/08/01 4.0 RPCSRC */
002: 
003: /*
004:  * Copyright (c) 2010, Oracle America, Inc.
005:  * Redistribution and use in source and binary forms, with or without
006:  * modification, are permitted provided that the following conditions are
007:  * met:
008:  *
009:  *     * Redistributions of source code must retain the above copyright
010:  *       notice, this list of conditions and the following disclaimer.
011:  *     * Redistributions in binary form must reproduce the above
012:  *       copyright notice, this list of conditions and the following
013:  *       disclaimer in the documentation and/or other materials
014:  *       provided with the distribution.
015:  *     * Neither the name of the "Oracle America, Inc." nor the names of its
016:  *       contributors may be used to endorse or promote products derived
017:  *       from this software without specific prior written permission.
018:  *
019:  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
020:  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
021:  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
022:  *   FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
023:  *   COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
024:  *   INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
025:  *   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
026:  *   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
027:  *   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
028:  *   WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
029:  *   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
030:  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
031:  */
032: 
033: /*
034:  * Gather statistics on remote machines
035:  */
036: 
037: #ifdef RPC_HDR
038: 
039: %#ifndef FSCALE
040: %/*
041: % * Scale factor for scaled integers used to count load averages.
042: % */
043: %#define FSHIFT  8               /* bits to right of fixed binary point */
044: %#define FSCALE  (1<<FSHIFT)
045: %
046: %#endif /* ndef FSCALE */
047: 
048: #endif /* def RPC_HDR */
049: 
050: const CPUSTATES = 4;
051: const DK_NDRIVE = 4;
052: 
053: /*
054:  * GMT since 0:00, January 1, 1970
055:  */
056: struct rstat_timeval {
057:         unsigned int tv_sec;    /* seconds */
058:         unsigned int tv_usec;   /* and microseconds */
059: };
060: 
061: struct statstime {                              /* RSTATVERS_TIME */
062:         int cp_time[CPUSTATES];
063:         int dk_xfer[DK_NDRIVE];
064:         unsigned int v_pgpgin;  /* these are cumulative sum */
065:         unsigned int v_pgpgout;
066:         unsigned int v_pswpin;
067:         unsigned int v_pswpout;
068:         unsigned int v_intr;
069:         int if_ipackets;
070:         int if_ierrors;
071:         int if_oerrors;
072:         int if_collisions;
073:         unsigned int v_swtch;
074:         int avenrun[3];         /* scaled by FSCALE */
075:         rstat_timeval boottime;
076:         rstat_timeval curtime;
077:         int if_opackets;
078: };
079: 
080: struct statsswtch {                     /* RSTATVERS_SWTCH */
081:         int cp_time[CPUSTATES];
082:         int dk_xfer[DK_NDRIVE];
083:         unsigned int v_pgpgin;  /* these are cumulative sum */
084:         unsigned int v_pgpgout;
085:         unsigned int v_pswpin;
086:         unsigned int v_pswpout;
087:         unsigned int v_intr;
088:         int if_ipackets;
089:         int if_ierrors;
090:         int if_oerrors;
091:         int if_collisions;
092:         unsigned int v_swtch;
093:         unsigned int avenrun[3];/* scaled by FSCALE */
094:         rstat_timeval boottime;
095:         int if_opackets;
096: };
097: 
098: struct stats {                          /* RSTATVERS_ORIG */
099:         int cp_time[CPUSTATES];
100:         int dk_xfer[DK_NDRIVE];
101:         unsigned int v_pgpgin;  /* these are cumulative sum */
102:         unsigned int v_pgpgout;
103:         unsigned int v_pswpin;
104:         unsigned int v_pswpout;
105:         unsigned int v_intr;
106:         int if_ipackets;
107:         int if_ierrors;
108:         int if_oerrors;
109:         int if_collisions;
110:         int if_opackets;
111: };
112: 
113: 
114: program RSTATPROG {
115:         /*
116:          * Newest version includes current time and context switching info
117:          */
118:         version RSTATVERS_TIME {
119:                 statstime
120:                 RSTATPROC_STATS(void) = 1;
121: 
122:                 unsigned int
123:                 RSTATPROC_HAVEDISK(void) = 2;
124:         } = 3;
125:         /*
126:          * Does not have current time
127:          */
128:         version RSTATVERS_SWTCH {
129:                 statsswtch
130:                 RSTATPROC_STATS(void) = 1;
131: 
132:                 unsigned int
133:                 RSTATPROC_HAVEDISK(void) = 2;
134:         } = 2;
135:         /*
136:          * Old version has no info about current time or context switching
137:          */
138:         version RSTATVERS_ORIG {
139:                 stats
140:                 RSTATPROC_STATS(void) = 1;
141: 
142:                 unsigned int
143:                 RSTATPROC_HAVEDISK(void) = 2;
144:         } = 1;
145: } = 100001;
146: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/