home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / ptdem3.zip / CPUSAMP.CMD < prev    next >
OS/2 REXX Batch file  |  1994-03-08  |  3KB  |  106 lines

  1. /***************************************/
  2. /* Pegasus Log Rexx Extension          */
  3. /* Version 1.0                         */
  4. /* (c) 1993,1994 C.O.L. Systems Inc.   */
  5. /* All Rights Reserved                 */
  6. /* CPU Sample Proc                     */
  7. /***************************************/
  8.  
  9. Data1. = "";         /* This is our data stem. Assumes one file input*/
  10.  
  11. Parse Arg   MyFile   /* Parse the file name on input to the proc     */
  12.  
  13. /************************/
  14. /* Load the extension   */
  15. /************************/
  16.  
  17. if RxFuncQuery('PegLoadFunctions') <> 0 then do
  18.    rcy = RxFuncAdd('PegLoadFunctions','PEGREXX','PegLoadFunctions')
  19.    if rcy = 0 then do
  20.       rcy = PegLoadFunctions()
  21.       if rcy > 0 then
  22.          signal BadLoad;
  23.       end;
  24.    else do
  25.       signal BadAdd;
  26.       end;
  27.    end;
  28.  
  29. /**************************/
  30. /* Load the file and stem */
  31. /**************************/
  32.  
  33. rcx = PegLoadFile(MyFile,"Data1.");
  34.  
  35. if rcx = 0 then do                  /* If there are no errors  */
  36.  
  37.    /* Copyright information   */
  38.  
  39.    say;
  40.    do count = 1 to 7
  41.       say   sourceline(count);
  42.       end;
  43.  
  44.    /* Supplied by originator  */
  45.  
  46.    say;
  47.    say "Data was created by "Data1.Title;   
  48.  
  49.    /* For each resource found flag, display the name  */
  50.  
  51.    say "Res # = "Data1.Resources;   
  52.  
  53.    do count = 1 to Data1.Resources  /* Display each on in list */
  54.       say   "Resource "count" = "Data1.Resources.count;
  55.       end
  56.  
  57.    /* Display the number of records */
  58.    say   "Records = "Data1.Records; 
  59.  
  60.    /* Display the number of apps  from APPMON or FILEMON */
  61.    say   "Apps    = "Data1.Records.Applications;
  62.  
  63.    /* Display the number of files from APPMON or FILEMON */
  64.    say   "Files   = "Data1.Records.Files;
  65.  
  66.    /* Loop through record count and calculate cpu busy   */
  67.  
  68.    if( Data1.Records > 0 ) then do
  69.       do count = 1 to Data1.Records
  70.          if Data1.Records.count.CPU then do
  71.             bsy = Data1.Records.count.CPU.tmCpu / Data1.Records.count.MT;
  72.             say PegDate(,Data1.Records.count.TDS)" Cpu Busy = " bsy * 100;
  73.             end;
  74.          end;
  75.       end;
  76.    end;
  77.  
  78. /* Report a file access error  */
  79.  
  80. else do
  81.    say "Error in file set = "rcx;
  82.    end;
  83.  
  84. /* Release the extension   */
  85.  
  86. rcx = PegDropFunctions();
  87. call RXFUNCDROP 'PEGLOADFUNCTIONS';
  88.  
  89. exit;
  90.  
  91. /****************************************************/
  92. /*  Error in syntax occured somewhere here          */
  93. /****************************************************/
  94.  
  95. BadAdd:
  96.  
  97.    say   'Error Adding Pegasus Rexx Function Loader';
  98.  
  99. exit;
  100.  
  101. BadLoad:
  102.  
  103.    say   'Error Loading Pegasus Rexx Functions';
  104.  
  105. exit;
  106.