(DEFINE-FILE-INFO READTABLE "INTERLISP" PACKAGE "INTERLISP" BASE 10)
(FILECREATED "30-Oct-87 01:18:07" "{FireFS:CS:Univ Rochester}<Koomen>LispUsers>Lyric>SYSTATS.;1" 7592   

      changes to%:  (VARS SYSTATSCOMS) (MACROS \SYSTATSREADBODY \MKSYSTATSBODY \NEWSYSTATSBODY \SYSTATSPROPBODY \SYSTATSDIFFBODY)
 (FNS \LOADFIXP \LOADFIXP2 SYSTATSDIFF \NEWSYSTATS \MKSYSTATS SYSTATSREAD SYSTATSPROP) (RECORDS SYSTATS)
 (PROPS (SYSTATS MAKEFILE-ENVIRONMENT))

      previous date%: "29-Oct-87 15:16:18" {DSK}<LISPFILES>SYSTATS.;1)


(* "
Copyright (c) 1987 by Johannes A. G. M. Koomen.  All rights reserved.
")

(PRETTYCOMPRINT SYSTATSCOMS)

(RPAQQ SYSTATSCOMS ((* ;; "Implementation") (DECLARE%: (LOCALVARS . T)) (DECLARE%: EVAL@COMPILE DONTEVAL@LOAD DONTCOPY (COMS (FILES (SOURCE FROM LISPUSERS) SYSEDIT) (P (SETQ SYSTATSPROPS (SORT (CONS (QUOTE ELAPSEDTIME) (INTERSECTION (RECORDFIELDNAMES (QUOTE MISCSTATS)) (QUOTE (DISKIOTIME DISKOPS GCTIME KEYBOARDWAITTIME NETIOOPS NETIOTIME PAGEFAULTS STARTTIME SWAPWAITTIME SWAPWRITES TOTALTIME)))))) (EVAL (BQUOTE (DATATYPE SYSTATS (\, SYSTATSPROPS) (CREATE (\NEWSYSTATS)))))))) (DECLARE%: DONTCOPY (COMS (RECORDS SYSTATS) (MACROS \SYSTATSPROPBODY \SYSTATSREADBODY \SYSTATSDIFFBODY \MKSYSTATSBODY \NEWSYSTATSBODY) (PROP (FILETYPE MAKEFILE-ENVIRONMENT) SYSTATS))) (INITRECORDS SYSTATS) (INITVARS (\SYSTATS NIL)) (FNS \NEWSYSTATS \MKSYSTATS \LOADFIXP \LOADFIXP2) (* ;; "Interface") (VARS SYSTATSPROPS) (FNS SYSTATSREAD SYSTATSDIFF SYSTATSPROP CLOCKTICKS))
)



(* ;; "Implementation")

(DECLARE%: 
(DECLARE%: DOEVAL@COMPILE DONTCOPY

(LOCALVARS . T)
)
)
(DECLARE%: EVAL@COMPILE DONTEVAL@LOAD DONTCOPY 
(FILESLOAD (SOURCE FROM LISPUSERS) SYSEDIT)
(SETQ SYSTATSPROPS (SORT (CONS (QUOTE ELAPSEDTIME) (INTERSECTION (RECORDFIELDNAMES (QUOTE MISCSTATS)) (QUOTE (DISKIOTIME DISKOPS GCTIME KEYBOARDWAITTIME NETIOOPS NETIOTIME PAGEFAULTS STARTTIME SWAPWAITTIME SWAPWRITES TOTALTIME))))))
(EVAL (BQUOTE (DATATYPE SYSTATS (\, SYSTATSPROPS) (CREATE (\NEWSYSTATS)))))
)
(DECLARE%: DONTCOPY 
(DECLARE%: EVAL@COMPILE

(DATATYPE SYSTATS (DISKIOTIME DISKOPS ELAPSEDTIME GCTIME KEYBOARDWAITTIME NETIOOPS NETIOTIME PAGEFAULTS STARTTIME SWAPWAITTIME SWAPWRITES TOTALTIME)
 (CREATE (\NEWSYSTATS)))
)
(/DECLAREDATATYPE (QUOTE SYSTATS) (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER)) (QUOTE ((SYSTATS 0 POINTER) (SYSTATS 2 POINTER) (SYSTATS 4 POINTER) (SYSTATS 6 POINTER) (SYSTATS 8 POINTER) (SYSTATS 10 POINTER) (SYSTATS 12 POINTER) (SYSTATS 14 POINTER) (SYSTATS 16 POINTER) (SYSTATS 18 POINTER) (SYSTATS 20 POINTER) (SYSTATS 22 POINTER))) (QUOTE 24))
(DECLARE%: EVAL@COMPILE 
(PUTPROPS \SYSTATSPROPBODY MACRO (NOARGS (BQUOTE (SELECTQ PROP (\,@ (for P in SYSTATSPROPS unless (EQ P (QUOTE ELAPSEDTIME)) collect (BQUOTE ((\, P) (ffetch (SYSTATS (\, P)) of FROMSYSTATS))))) (ERROR "Unsupported SYSTATS property:" PROP)))))
(PUTPROPS \SYSTATSREADBODY MACRO (NOARGS (BQUOTE (PROGN (\,@ (for P in SYSTATSPROPS collect (BQUOTE (\LOADFIXP2 (ffetch (SYSTATS (\, P)) of INTOSYSTATS) (ffetch (SYSTATS (\, P)) of FROMSYSTATS)))))))))
(PUTPROPS \SYSTATSDIFFBODY MACRO (NOARGS (BQUOTE (PROGN (\,@ (for P in SYSTATSPROPS collect (BQUOTE (\LOADFIXP (ffetch (SYSTATS (\, P)) of DIFSYSTATS) (IDIFFERENCE (ffetch (SYSTATS (\, P)) of NEWSYSTATS) (ffetch (SYSTATS (\, P)) of OLDSYSTATS))))))))))
(PUTPROPS \MKSYSTATSBODY MACRO (NOARGS (BQUOTE (PROG NIL (DECLARE (GLOBALVARS \MISCSTATS \SYSTATS)) (if (NOT NOCLOCKFLG) then (\LOADFIXP2 (ffetch (SYSTATS ELAPSEDTIME) of \SYSTATS) (CLOCK0 \SYSTATSCLOCK0))) (\,@ (for P in SYSTATSPROPS unless (EQ P (QUOTE ELAPSEDTIME)) collect (BQUOTE (\LOADFIXP2 (ffetch (SYSTATS (\, P)) of \SYSTATS) (LOCF (ffetch (MISCSTATS (\, P)) of \MISCSTATS))))))))))
(PUTPROPS \NEWSYSTATSBODY MACRO (NOARGS (BQUOTE (PROG ((STATS (NCREATE (QUOTE SYSTATS)))) (\,@ (for P in SYSTATSPROPS collect (BQUOTE (freplace (SYSTATS (\, P)) of STATS with (create FIXP))))) (RETURN STATS)))))
)

(PUTPROPS SYSTATS FILETYPE :TCOMPL)

(PUTPROPS SYSTATS MAKEFILE-ENVIRONMENT (:READTABLE "INTERLISP" :PACKAGE "INTERLISP" :BASE 10))
)
(/DECLAREDATATYPE (QUOTE SYSTATS) (QUOTE (POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER POINTER)) (QUOTE ((SYSTATS 0 POINTER) (SYSTATS 2 POINTER) (SYSTATS 4 POINTER) (SYSTATS 6 POINTER) (SYSTATS 8 POINTER) (SYSTATS 10 POINTER) (SYSTATS 12 POINTER) (SYSTATS 14 POINTER) (SYSTATS 16 POINTER) (SYSTATS 18 POINTER) (SYSTATS 20 POINTER) (SYSTATS 22 POINTER))) (QUOTE 24))

(RPAQ? \SYSTATS NIL)
(DEFINEQ

(\NEWSYSTATS
(LAMBDA NIL (* ; "Edited 30-Oct-87 00:16 by Koomen") (\NEWSYSTATSBODY)))

(\MKSYSTATS
(LAMBDA (STATS SYSFLG NOCLOCKFLG) (* ; "Edited 29-Oct-87 22:14 by Koomen") (DECLARE (GLOBALVARS \MISCSTATS \SYSTATS \SYSTATSCLOCK0)) (if STATS then (\DTEST STATS (QUOTE SYSTATS)) elseif (NOT SYSFLG) then (create SYSTATS) else (if (NULL \SYSTATS) then (SETQ \SYSTATS (create SYSTATS)) (SETQ \SYSTATSCLOCK0 (create FIXP)) else (\DTEST \SYSTATS (QUOTE SYSTATS))) (\MKSYSTATSBODY) \SYSTATS))
)

(\LOADFIXP
(LAMBDA (DST SRC) (* ; "Edited 30-Oct-87 00:27 by Koomen") (* ;; "DST is assumed to be a FIXP") (* ;; "SRC is assumed to be either a FIXP or a SMALLP") (if (type? FIXP SRC) then (freplace (FIXP HINUM) of DST with (ffetch (FIXP HINUM) of SRC)) (freplace (FIXP LONUM) of DST with (ffetch (FIXP LONUM) of SRC)) elseif (ILESSP SRC 0) then (freplace (FIXP HINUM) of DST with MAX.SMALLP) (freplace (FIXP LONUM) of DST with (ADD1 (IPLUS SRC MAX.SMALLP))) else (freplace (FIXP HINUM) of DST with 0) (freplace (FIXP LONUM) of DST with SRC)) DST)
)

(\LOADFIXP2
(LAMBDA (DST SRC) (* ; "Edited 30-Oct-87 00:27 by Koomen") (* ;; "DST and SRC are assumed to be a FIXP") (freplace (FIXP HINUM) of DST with (ffetch (FIXP HINUM) of SRC)) (freplace (FIXP LONUM) of DST with (ffetch (FIXP LONUM) of SRC)) DST)
)
)



(* ;; "Interface")


(RPAQQ SYSTATSPROPS (DISKIOTIME DISKOPS ELAPSEDTIME GCTIME KEYBOARDWAITTIME NETIOOPS NETIOTIME PAGEFAULTS STARTTIME SWAPWAITTIME SWAPWRITES TOTALTIME)
)
(DEFINEQ

(SYSTATSREAD
(LAMBDA (INTOSTATS FROMSTATS) (* ; "Edited 29-Oct-87 12:52 by Koomen") (PROG ((INTOSYSTATS (\MKSYSTATS INTOSTATS)) (FROMSYSTATS (\MKSYSTATS FROMSTATS T))) (\SYSTATSREADBODY) (RETURN INTOSYSTATS)))
)

(SYSTATSDIFF
(LAMBDA (OLDSTATS NEWSTATS DIFSTATS) (* ; "Edited 30-Oct-87 00:35 by Koomen") (PROG ((OLDSYSTATS (\MKSYSTATS OLDSTATS T)) (NEWSYSTATS (\MKSYSTATS NEWSTATS T)) (DIFSYSTATS (\MKSYSTATS DIFSTATS))) (\SYSTATSDIFFBODY) (RETURN DIFSYSTATS)))
)

(SYSTATSPROP
(LAMBDA (PROP FROMSTATS) (* ; "Edited 29-Oct-87 14:51 by Koomen") (if (EQ PROP (QUOTE ELAPSEDTIME)) then (ffetch (SYSTATS ELAPSEDTIME) of (\MKSYSTATS FROMSTATS T)) else (PROG ((FROMSYSTATS (\MKSYSTATS FROMSTATS T T))) (RETURN (\SYSTATSPROPBODY)))))
)

(CLOCKTICKS
(LAMBDA (interval timerunits) (* Koomen "12-Jan-87 17:22") (DECLARE (GLOBALVARS \RCLKSECOND)) (PROG ((ticks (if (NULL interval) then 1 elseif (NOT (NUMBERP interval)) then (ERROR "Non-numeric arg: " interval) elseif (NOT (GREATERP interval 0)) then (ERROR "Non-positive arg: " interval) else interval))) (SELECTQ (U-CASE timerunits) ((TICK TICKS)) ((MSEC MILLISEC MSECS MILLISECS) (SETQ ticks (FTIMES 0.001 \RCLKSECOND ticks))) ((NIL SEC SECOND SECS SECONDS) (SETQ ticks (TIMES \RCLKSECOND ticks))) ((MIN MINUTE MINS MINUTES) (SETQ ticks (TIMES 60 \RCLKSECOND ticks))) ((HR HOUR HRS HOURS) (SETQ ticks (TIMES 3600 \RCLKSECOND ticks))) (ERROR "unknown timerunits: " timerunits)) (RETURN (if (FLOATP ticks) then (FIX (FPLUS ticks 0.5)) else ticks))))
)
)
(PUTPROPS SYSTATS COPYRIGHT ("Johannes A. G. M. Koomen" 1987))
(DECLARE%: DONTCOPY
  (FILEMAP (NIL (4518 5824 (\NEWSYSTATS 4528 . 4613) (\MKSYSTATS 4615 . 5016) (\LOADFIXP 5018 . 5567) (
\LOADFIXP2 5569 . 5822)) (6002 7506 (SYSTATSREAD 6012 . 6223) (SYSTATSDIFF 6225 . 6475) (SYSTATSPROP 
6477 . 6740) (CLOCKTICKS 6742 . 7504)))))
STOP