home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / rxpmpapi.zip / monevts.cmd < prev    next >
OS/2 REXX Batch file  |  1997-06-15  |  2KB  |  65 lines

  1. /* Rexx */
  2. call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  3. call SysLoadFuncs
  4.  
  5. SIGNAL ON NOVALUE
  6.  
  7. call RxFuncAdd 'RxDCFLoadFuncs', 'RXPMPAPI', 'RxDCFLoadFuncs'
  8. call RxDCFLoadFuncs
  9.  
  10. /* Build array of events to monitor. */
  11. events.0 = 12
  12. events.1 = 'SwpGrow'
  13. events.2 = 'CpuAvg'
  14. events.3 = 'VRamFree'
  15. events.4 = 'Drive1'
  16. events.5 = 'Drive2'
  17. events.6 = 'Drive3'
  18. events.7 = 'Drive4'
  19. events.8 = 'Drive5'
  20. events.9 = 'Drive6'
  21. events.10 = 'BatFree'
  22. events.11 = 'SwpFree'
  23. events.12 = 'RamFree'
  24.  
  25. /* Load initial count values into counts. */
  26. call RxDCFGetStats 'dcfstats.'
  27. do i = 1 to events.0
  28.    evtName.i = TRANSLATE('event'||events.i||'Cnt')
  29.    evtTime.i = TRANSLATE('event'||events.i||'LTime')
  30.    evtCnt = evtName.i
  31.    counts.i = dcfstats.evtCnt
  32. end /* do */
  33.  
  34. /* Clear the user-defined field. */
  35. call RxDCFUserDefined ''
  36.  
  37. say "Monitoring events:"
  38. do i = 1 to events.0
  39.    say events.i
  40. end
  41.  
  42. /* Check for incremented count values every 5 seconds. */
  43. do while 1
  44.    call SysSleep 10
  45.  
  46.    call RxDCFGetStats 'dcfstats.'
  47.  
  48.    /* Check each event to see if it increased after last time. */
  49.    do i = 1 to events.0
  50.       evtCnt = evtName.i
  51.       if counts.i < dcfstats.evtCnt then do
  52.          count.i = dcfstats.evtCnt
  53.          /* Set User Defined field to event name. */
  54.          curTime = evtTime.i
  55.          call RxDCFUserDefined events.i dcfstats.curTime
  56.       end  /* Do */
  57.  
  58.       /* User might reset event counts to 0. */
  59.       if counts.i \= dcfstats.evtCnt then
  60.          counts.i = dcfstats.evtCnt
  61.  
  62.    end /* do */
  63. end /* do */
  64.  
  65.