[INHERIT('sys$library:starlet', 'sys$library:pascal$lib_routines')] PROGRAM Use_Getjpiw(OUTPUT); TYPE Item_List_Cell = RECORD CASE INTEGER OF 1: ( { Normal Cell } Buffer_Length : [WORD] 0..65535; Item_Code : [WORD] 0..65535; Buffer_Addr : UNSIGNED; Return_Addr : UNSIGNED ); 2:( { Terminator } Terminator : UNSIGNED ); END; Item_List_Template(Count:INTEGER) = ARRAY [1..Count] OF Item_List_Cell; VAR Item_List : Item_List_Template(4); Process_Name : [VOLATILE] VARYING [15] OF CHAR; Buffered_IO : [VOLATILE] INTEGER; PageFaults : [VOLATILE] INTEGER; Status, Total_Process_Count, Total_PageFaults : INTEGER := 0; Context : INTEGER := -1; BEGIN { Initialize the item list elements } { The process name... } Item_List[1].Buffer_Length := SIZE(Process_Name.Body); Item_List[1].Item_Code := JPI$_Prcnam; Item_List[1].Buffer_Addr := IADDRESS(Process_Name.Body); Item_List[1].Return_Addr := IADDRESS(Process_Name.Length); { The amount of buffered IO... } Item_List[2].Buffer_Length := SIZE(Buffered_IO); Item_List[2].Item_Code := JPI$_Bufio; Item_List[2].Buffer_Addr := IADDRESS(Buffered_IO); Item_List[2].Return_Addr := 0; { The number of page faults... } Item_List[3].Buffer_Length := SIZE(PageFaults); Item_List[3].Item_Code := JPI$_Pageflts; Item_List[3].Buffer_Addr := IADDRESS(PageFaults); Item_List[3].Return_Addr := 0; { Terminate the item list } Item_List[4].Terminator := 0; { Loop over all the processes on the system. } REPEAT Status := $getjpiw(PidAdr := %REF Context, Itmlst := Item_List); IF (NOT ODD(Status)) AND (Status <> SS$_NOMOREPROC) AND (Status <> SS$_NOPRIV) THEN LIB$Stop(Status); IF Status = SS$_NORMAL THEN BEGIN WRITELN('Process: ',Process_Name, '; BufIO = ',Buffered_IO:1, '; PageFlts = ',PageFaults:1); Total_Process_Count := Total_Process_Count + 1; Total_PageFaults := Total_PageFaults + PageFaults; END ELSE IF Status = SS$_NOPRIV THEN BEGIN WRITELN('Skipping process; not allowed to access data'); Total_Process_Count := Total_Process_Count + 1; END; UNTIL Status = SS$_NOMOREPROC; WRITELN('Total Process Count = ',Total_Process_Count:1); WRITELN('Total PageFault Count = ',Total_PageFaults:1); END.