home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: OtherApp
/
OtherApp.zip
/
rm2app2.zip
/
rm2app2.cmd
< prev
next >
Wrap
OS/2 REXX Batch file
|
1995-04-08
|
6KB
|
205 lines
/***************************************/
/* Osrm2 Lite Rexx Extension */
/* Version 3.0 */
/* (c) 1993,1995 C.O.L. Systems Inc. */
/* All Rights Reserved */
/* Application Process Sample Proc 2 */
/***************************************/
Data1. = ""; /* This is our data stem. Assumes one file input*/
Parse Arg MyFile /* Parse the file name on input to the proc */
/************************/
/* Load the extension */
/************************/
if RxFuncQuery('Rm2LoadFunctions') <> 0 then do
rcy = RxFuncAdd('Rm2LoadFunctions','RM2REXXL','Rm2LoadFunctions')
if rcy = 0 then do
rcy = Rm2LoadFunctions()
if rcy > 0 then
signal BadLoad;
end;
else do
signal BadAdd;
end;
end;
say;
do count = 1 to 7
say sourceline(count);
end;
say;
say "Reading records, please wait...";
signal on HALT name ExceptionCalled; /* SETUP EXCEPTION HANDLERS */
signal on ERROR name ExceptionCalled; /* SETUP EXCEPTION HANDLERS */
signal on FAILURE name ExceptionCalled; /* SETUP EXCEPTION HANDLERS */
/**************************/
/* Load the file and stem */
/**************************/
reference = Rm2OpenFile(MyFile,"Data1.");
if reference == 0 then
signal BadOpen;
/* If the load is ok, and data originated with the AppMon tool */
if Data1.Creator == 1 then do
/* Supplied by originator */
say;
say "Data was created by "Data1.Title" from file "MyFile;
/* While there are records to be read */
do while Rm2GetRecord( "Data1." , reference )
/* For each application in the application list */
do appslook = 1 to Data1.Records.Applications
say ;
say ;
say 'Process Name = 'Data1.Records.Applications.appslook.Name,
'Date :' Rm2Date('U',Data1.Records.0.TDS),
' Time :' Rm2Time('N',Data1.Records.0.TDS) ;
say 'Tid Dispatch Busy% TimeRun PageFaults PageWait FileWait';
say '---------------------------------------------------------------------------';
stotal = 0;
ttotal = 0;
cpgflt = 0;
tpgtm = 0;
tfltm = 0;
ttbsy = 0;
tttic = 0;
/* For each record in the stem*/
do count = 0 to Data1.Records
/* For each non 0 thd group */
if Data1.Records.count.THD > 0 then do
do tcount = 1 to Data1.Records.count.THD
dataRef = 'Data1.Records.'||count||'.THD.'||tcount||'.Pid';
/* For each thread that has a matching process ID */
/* display measurements and calculations */
if Data1.Records.Applications.appslook.PID == value(dataRef) then do
dataRef = 'Data1.Records.'||count||'.THD.'||tcount;
tbsy = value(dataRef||'.tmRun');
ttbsy = ttbsy + tbsy;
if Data1.Records.count.MT > 0 then
tbsy = (tbsy / Data1.Records.count.MT) * 100.0;
else
tbsy = 0.0;
tttic = tttic + Data1.Records.count.MT;
stotal = stotal + value(dataRef||'.ctSched');
ttotal = ttotal + value(dataRef||'.tmRun');
cpgflt = cpgflt + value(dataRef||'.ctFaults');
tpgtm = tpgtm + value(dataRef||'.tmFaults');
tfltm = tfltm + value(dataRef||'.tmFileWait');
say format( value(dataRef||'.Tid') , 3)||' ',
format( value(dataRef||'.ctSched') , 9),
format( tbsy , 8,2),
format( value(dataRef||'.tmRun') , 8,2)||' ',
format( value(dataRef||'.ctFaults'),10),
format( value(dataRef||'.tmFaults'),8,2)||' ',
format( value(dataRef||'.tmFileWait'),8,2);
end;
end;
end;
end;
if tttic > 0.0 then
ttbsy = (ttbsy / tttic) * 100.0;
else
ttbsy = 0.0;
say '---------------------------------------------------------------------------';
say 'Tot.',
format( stotal , 9),
format( ttbsy , 8,2),
format( ttotal , 8,2)||' ',
format( cpgflt , 10),
format( tpgtm,8,2)||' ',
format( tfltm,8,2);
end;
end;
rcx = Rm2CloseFile( 'Data1.', reference );
end;
/* Report a file access error */
else do
say "Error in file set = "rcx;
if Data1.Creator <> 1 then
say 'Not a AppMon log!';
end;
/* Release the extension */
rcx = Rm2DropFunctions();
call RXFUNCDROP 'RM2LOADFUNCTIONS';
exit;
/****************************************************/
/* Error opening the file caused a problem with proc*/
/****************************************************/
BadOpen:
say "Error opening file";
exit;
/****************************************************/
/* Error in syntax occured somewhere here */
/****************************************************/
BadAdd:
say 'Error Adding Osrm2 Rexx Function Loader';
exit;
BadLoad:
say 'Error Loading Osrm2 Rexx Functions';
exit;
/***************************************************/
/* Exception handler for insuring process cleanup */
/***************************************************/
ExceptionCalled :
say "Exception Reached";
r = Rm2Exception();
rcx = Rm2DropFunctions();
call RXFUNCDROP 'RM2LOADFUNCTIONS';
exit;