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

  1. /***************************************/
  2. /* Pegasus Log Rexx Extension          */
  3. /* Version 1.10                        */
  4. /* (c) 1993,1994 C.O.L. Systems Inc.   */
  5. /* All Rights Reserved                 */
  6. /* Application Process 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 the load is ok, and data originated with the FileMon tool   */
  36.  
  37. say   Data1.Creator;
  38.  
  39. if rcx == 0 & Data1.Creator == 1 then do
  40.  
  41.    /* Copyright information   */
  42.  
  43.    say;
  44.    do count = 1 to 7
  45.       say   sourceline(count);
  46.       end;
  47.  
  48.    /* Supplied by originator  */
  49.  
  50.    say;
  51.    say "Data was created by "Data1.Title;   
  52.  
  53.    /* For each resource found flag, display the name  */
  54.  
  55.    say "Res # = "Data1.Resources;   
  56.  
  57.    do count = 1 to Data1.Resources  /* Display each on in list */
  58.       say   "Resource "count" = "Data1.Resources.count;
  59.       end
  60.  
  61.    /* Display the number of records */
  62.    say   "Records = "Data1.Records; 
  63.  
  64.    /* Display the number of apps  from APPMON or FILEMON */
  65.    say   "Apps    = "Data1.Records.Applications;
  66.  
  67.    /* Display the number of files from APPMON or FILEMON */
  68.  
  69.    say   "Files   = "Data1.Records.Files;
  70.  
  71.    /* Display file resource by filename   */
  72.  
  73.    if( Data1.Records > 0 ) then do
  74.       metcnt = PegMetric('THD');          /* Get for later calls  */
  75.  
  76.       do count = 1 to Data1.Records
  77.  
  78.          if Data1.Records.count.THD > 0 then do   /* Do we have entries */
  79.             
  80.             do tcount = 1 to Data1.Records.count.THD
  81.  
  82.             /***************************/
  83.             /* For each detail thread  */
  84.             /* measurement sample, we  */
  85.             /* use the UID to resolve  */
  86.             /* the app name from the   */
  87.             /* application table       */
  88.             /***************************/
  89.  
  90.                dataRef = 'Data1.Records.'||count||'.THD.'||tcount||'.Pid';
  91.  
  92.                do appslook = 1 to Data1.Records.Applications
  93.                   if Data1.Records.Files.appslook.PID == value(dataRef) then do
  94.                      say   ;
  95.                      say   'Process 'Data1.Records.Applications.appslook.Name;
  96.                      say   ;
  97.                      appslook = Data1.Records.Applications;
  98.                      end;
  99.                   end;
  100.  
  101.             /***************************/
  102.             /* Now we display each of  */
  103.             /* the metrics without the */
  104.             /* knowledge of their name */
  105.             /* using the PegMetric call*/
  106.             /***************************/
  107.  
  108.                do mcount = 1 to metcnt
  109.                   dataRef = 'Data1.Records.'||count||'.THD.'||tcount||PegMetric('THD',mcount);
  110.                   say 'Thread 'PegMetric('THD',mcount)' = 'value(dataRef);
  111.                   end;
  112.                end;
  113.             end;
  114.          end;
  115.       end;
  116.    end;
  117.  
  118. /* Report a file access error  */
  119.  
  120. else do
  121.    say "Error in file set = "rcx;
  122.    if Data1.Creator <> 1 then
  123.     say 'Not a AppMon log!';
  124.    end;
  125.  
  126. /* Release the extension   */
  127.  
  128. rcx = PegDropFunctions();
  129. call RXFUNCDROP 'PEGLOADFUNCTIONS';
  130.  
  131. exit;
  132.  
  133. /****************************************************/
  134. /*  Error in syntax occured somewhere here          */
  135. /****************************************************/
  136.  
  137. BadAdd:
  138.  
  139.    say   'Error Adding Pegasus Rexx Function Loader';
  140.  
  141. exit;
  142.  
  143. BadLoad:
  144.  
  145.    say   'Error Loading Pegasus Rexx Functions';
  146.  
  147. exit;
  148.  
  149.