subroutine prtres(job,iounit)
c**********************************************************************
c SPLIB Copyright (C) 1995 **
c Indiana University **
c**********************************************************************
c------------------------------------------------------------------------
c
c Read and writes the fields from the C structure rusage. This is
c called from Fortran, and then calls the C routine getrusage().
c
c On first call, this just gives the results of getrusage. On
c succeeding calls, it will give the difference between the values
c of this and the earlier call. The exception to this is the
c maximum resident set size. That cannot be given for just the
c segment between two calls to getrusage(), without being able to
c simply reset the value stored in the struct used by the system.
c
c job : 0 means initial call, not to print out anything.
c : 1 means successive call, to print out everything.
c
c This version writes out HTML-formatted data. It assumes you have
c already written out a
to start the list, and will write
c out
to end it.
c
c Randall Bramley
c Department of Computer Science
c Indiana University
c email: bramley@cs.indiana.edu
c Wed Jul 27 11:47:07 EST 1994
c
c------------------------------------------------------------------------
implicit none
c output unit number:
integer iounit, job
real*8 utime, stime, tottime, ut, st
integer maxrss, ixrss, idrss, isrss
integer minflt, majflt, nswap, inblock, oublock
integer msgsnd, msgrcv, nsignals, nvcsw, nivcsw
integer counts0(15)
save counts0
real*8 utime0, stime0
save utime0, stime0
integer counts(15), k
data utime0, stime0 /2*0.0d0/
data counts0 /15*0/
call getr(ut,st,counts)
utime = ut - utime0
stime = st - stime0
utime0 = ut
stime0 = st
tottime = utime + stime
maxrss = counts(1 )
ixrss = counts(2 ) - counts0(2 )
idrss = counts(3 ) - counts0(3 )
isrss = counts(4 ) - counts0(4 )
minflt = counts(5 ) - counts0(5 )
majflt = counts(6 ) - counts0(6 )
nswap = counts(7 ) - counts0(7 )
inblock = counts(8 ) - counts0(8 )
oublock = counts(9 ) - counts0(9 )
msgsnd = counts(10) - counts0(10)
msgrcv = counts(11) - counts0(11)
nsignals = counts(12) - counts0(12)
nvcsw = counts(13) - counts0(13)
nivcsw = counts(14) - counts0(14)
do k = 2, 14
counts0(k) = counts(k)
end do
if (job .le. 0 ) return
c write(iounit,100) utime
100 format(' User cpu time : ',d12.5)
c write(iounit,101) stime
101 format(' System cpu time: ',d12.5)
c write(iounit,102) tottime
102 format(' Total time : ',d12.5)
write(iounit,201) maxrss
201 format('Maximum resident set size : ',i9)
write(iounit,202) ixrss
202 format('Text memory in shared libraries : ',i9)
write(iounit,203) idrss
203 format('Unshared data space kb/s : ', i9)
write(iounit,204) isrss
204 format('Unused quantity (not on IBM) : ',i9)
write(iounit,205) minflt
205 format('Page faults without I/O activity : ',i9)
write(iounit,206) majflt
206 format('Page faults with I/O activity : ',i9)
write(iounit,207) nswap
207 format('Number of swaps out of main memory: ',i9)
write(iounit,208) inblock
208 format('Number of file system input : ',i9)
write(iounit,209) oublock
209 format('Number of file system output : ',i9)
write(iounit,210) msgsnd
210 format('Number of IPC messages sent : ',i9)
write(iounit,211) msgrcv
211 format('Number of IPC messages received : ',i9)
write(iounit,212) nsignals
212 format('Number of signals delivered : ',i9)
write(iounit,213) nvcsw
213 format('Voluntary context switches : ',i9)
write(iounit,214) nivcsw
214 format('Involuntary context switches : ',i9)
write(iounit,215)
215 format('')
return
end