$!------------------------------------------------------------------------------ $! JPI.COM - Analysis Tool $! DCE V1.3 for OpenVMS $! $! COPYRIGHT (C) 1995 BY $! DIGITAL EQUIPMENT CORPORATION, MAYNARD $! MASSACHUSETTS. ALL RIGHTS RESERVED. $! $! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED $! ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE INCLUSION $! OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER COPIES $! THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER $! PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY TRANSFERRED. $! $! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE AND $! SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT CORPORATION. $! $! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS $! SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY DIGITAL. $! $!------------------------------------------------------------------------------ $! $! $! $! This procedure extracts all the system performance related items using $! the process information via F$GETJPI. $! $! AUTHOR: Jim Lanciani $! NAME : JPI.COM $! DATE : 5-AUG-1987 $! $! History : $! 7-mar-1995 SSG Added provision to direct output to $! a file and displaying the time of $! each data display $! $! 12-mar-1995 SSG Added changes made by Gaitan and Carol $! $! $! $! Usage : $! @JPI p1 p2 p3 p4 p5 p6 p7 $! $! p1 - process name $! p2 - time interval as [hh:mm:]ss $! p3 - y(es) or n(o) to display data on the terminal $! p4 - y(es) or n(o) to write data to a file $! p5 - file name if p4 is y(es) $! p6 - comment to be written with data if output is to a file $! $! $! Output may be simultaneously displayed on a terminal AND written to $! a file $! $! $ error_condition_rtn: $ on error then goto exit_rtn $ on warning then goto exit_rtn $ on control_y then goto exit_rtn $ on control_c then goto exit_rtn $! $ setup_rtn: $ wso = "write sys$output" $ a = "" $ pid = "" $ context = "" $ disp_to_term = "y" $ disp_to_file = "n" $ dispname = "" $ do_once := false $! $ enter_process_name_rtn: $ ent_proc_name = p1 $ interval = p2 $ useterm = p3 $ usefile = p4 $ dispname = p5 $ comment = p6 $ if ent_proc_name .eqs. "" then inquire ent_proc_name "Enter Process Name" !p1 $ if interval .eqs. "" then inquire interval "Enter interval HH:MM:SS" !p2 $ gosub process_time $ if useterm .eqs. "" then inquire useterm "Output to terminal (y/n)?" !p3 $ if usefile .eqs. "" then inquire usefile "Output to a file (y/n)?" !p4 $ if usefile $ then $ if dispname .eqs. "" then inquire dispname "Enter file name" !p5 $ if comment .eqs. "" then inquire comment "Enter comment" $ fl = f$search("''dispname'") $ if fl .eqs. "" $ then $ open/write outfile 'dispname' $ else $ open/append outfile 'dispname' $ endif $ endif $! $! $ process_time: $! $! if no : present then treat it as seconds and format, If one : exists $! then treat as mm:ss and if 2 exist then treat as hh:mm:ss $! $ hashrs := true $ hasmins := true $ first = f$element(0,":",interval) $ second = f$element(1,":",interval) $ third = f$element(2,":",interval) $ if third .eqs. ":" then hashrs := false !mm:ss $ if second .eqs. ":" then hasmins := false !ss $ if hashrs $ then $ hrs = f$integer(first) $ mins = f$integer(second) $ secs = f$integer(third) $ else $ if hasmins $ then $ hrs = 0 $ mins = f$integer(first) $ secs = f$integer(second) $ else $ hrs = 0 $ mins = 0 $ secs = f$integer(first) $ endif $ endif $ totsecs = hrs*3600 + mins*60 + secs $ if totsecs .eq. 0 then do_once := true $! convert back to string hh:m:ss $ if hashrs .or. hasmins then Return !already in format $ hrs = totsecs/3600 $ mins = (totsecs - hrs*3600)/60 $ secs = totsecs - hrs*3600 - mins*60 $ interval = "''hrs':''mins':''secs'" $ Return $! $! $! $ get_pid_rtn: $ pid = f$pid(context) $ if pid .eqs. "" then goto exit_rtn $ curr_pid = a + pid + a $ curr_proc_name = f$getjpi(PID,"PRCNAM") $ term_name = f$getjpi(PID,"TERMINAL") $ if curr_proc_name .eqs. ent_proc_name $ then $ if useterm then gosub dsply_scrn_hdr $ do_again: $ gosub get_jpi_rtn $ if useterm then gosub dsply_scrn_data $ if usefile then gosub dsply_file_rtn $ if do_once then goto exit_rtn $ wait 'interval' $ goto do_again $ else $ goto get_pid_rtn $ endif $! $!----------------------------------------------------------------------------- $! Subroutine to display headers in screen output $!----------------------------------------------------------------------------- $ dsply_scrn_hdr: $! $! Output of Line 1 and 2 (Double High - Double Wide) $! $ wso "#3Process Name: ", curr_proc_name, " Term: ",term_name $ wso "#4Process Name: ", curr_proc_name, " Term: ",term_name $! $! Output of Line 3 $! $ wso "" $! $! Output of Line 4 $! $ wso "Active Page Table Count:",- "Pages Avail for Vir Mem Exp:" $! $! Output of Line 5 $! $ wso "Remaining Buffered IO Quota:",- "Global Page Count:" $! $! Output of Line 6 $! $ wso "Buffered IO Limit Quota:",- "Page Faults:" $! $! Output of Line 7 $! $ wso "Buffered IO's:",- "Remaining Page File Quota:" $! $! Output of Line 8 $! $ wso "Rem Buffered IO Count Quota:",- "Page File Quota:" $! $! Output of Line 9 $! $ wso "Buffered IO Byte Limit Quota:",- "Process Page Count:" $! $! Output of Line 10 $! $ wso "Limit on Process CPUtime:",- "State:" $! $! Output of Line 11 $! $ wso "CPU Time:",- "Max Auth W/S Size:" $! $! Output of Line 12 $! $ wso "Def Page Fault Cluster Size:",- "Max Auth W/S Ext:" $! $! Output of Line 13 $! $ wso "Def W/S Size:",- "Current W/S Size Ext:" $! $! Output of Line 14 $! $ wso "Remaining Direct IO Count:",- "W/S Peak:" $! $! Output of Line 15 $! $ wso "Direct IO Limit Quota:",- "W/S Size Quota:" $! $! Output of Line 16 $! $ wso "Direct IO's:",- "Process Current W/S Size:" $! $! Output of Line 17 $! $ wso "Remaining Open File Quota:",- "Open File Quota:" $! $! Output of Line 18 $! $ wso "Remaining AST Quota:",- "AST Limit:" $! $! Output of Line 19 $! $ wso "Active ASTs:",- "Enabled ASTs:" $! $! Output of Line 20 $! $ wso "# of Pages in PAGEFILE.SYS:",- "# of Pages in SWAPFILE.SYS:" $! $! Output of Line 21 $! $ wso "Free Pages in PAGEFILE.SYS:",- "Free Pages in SWAPFILE.SYS:" $! $! Output of Line 22 $! $ wso "FREEP0VA:",- "FREEP1VA:" $! $! Output of Line 23 $! $ wso "Active Image_name:" $! $ return $! $!----------------------------------------------------------------------------- $! Get process information $!----------------------------------------------------------------------------- $ get_jpi_rtn: $ apt_cnt = f$getjpi(pid,"APTCNT") $ bio_cnt = f$getjpi(pid,"BIOCNT") $ bio_lim = f$getjpi(pid,"BIOLM") $ buf_io = f$getjpi(pid,"BUFIO") $ byt_cnt = f$getjpi(pid,"BYTCNT") $ byt_lim = f$getjpi(pid,"BYTLM") $ cpu_lim = f$getjpi(pid,"CPULIM") $ cpu_tim = f$getjpi(pid,"CPUTIM") $ df_pfc = f$getjpi(pid,"DFPFC") $ df_ws_cnt = f$getjpi(pid,"DFWSCNT") $ dio_cnt = f$getjpi(pid,"DIOCNT") $ dio_lim = f$getjpi(pid,"DIOLM") $ dir_io = f$getjpi(pid,"DIRIO") $ fil_cnt = f$getjpi(pid,"FILCNT") $ fil_lim = f$getjpi(pid,"FILLM") $ fre_pte_cnt = f$getjpi(pid,"FREPTECNT") $ gpg_cnt = f$getjpi(pid,"GPGCNT") $ image_name = f$getjpi(pid,"IMAGNAME") $ page_flts = f$getjpi(pid,"PAGEFLTS") $ page_fil_cnt = f$getjpi(pid,"PAGFILCNT") $ page_fil_quota = f$getjpi(pid,"PGFLQUOTA") $ proc_pg_cnt = f$getjpi(pid,"PPGCNT") $ prc_name = f$getjpi(pid,"PRCNAM") $ state = f$getjpi(pid,"STATE") $ ws_auth = f$getjpi(pid,"WSAUTH") $ ws_auth_ext = f$getjpi(pid,"WSAUTHEXT") $ ws_ext = f$getjpi(pid,"WSEXTENT") $ ws_peak = f$getjpi(pid,"WSPEAK") $ ws_quota = f$getjpi(pid,"WSQUOTA") $ ws_size = f$getjpi(pid,"WSSIZE") $! $! SSG added $! $ ast_cnt = f$getjpi(pid,"ASTCNT") $ ast_lim = f$getjpi(pid,"ASTLM") $ ast_act = f$getjpi(pid,"ASTACT") $ ast_en = f$getjpi(pid,"ASTEN") $! $ page_fil_size = f$getsyi("PAGEFILE_PAGE") $ page_fil_free = f$getsyi("PAGEFILE_FREE") $ swap_fil_size = f$getsyi("SWAPFILE_PAGE") $ swap_fil_free = f$getsyi("SWAPFILE_FREE") $! $ free_p0 = f$getjpi(pid,"FREP0VA") $ if free_p0 .eqs. "" then free_p0 = "00000000" $ free_p1 = f$getjpi(pid,"FREP1VA") $ if free_p1 .eqs. "" then free_p1 = "--------" $! $ Return $! $!----------------------------------------------------------------------------- $! Display the process info on the screen $!----------------------------------------------------------------------------- $ dsply_scrn_data: $ wso "", 'apt_cnt' $ wso "", 'fre_pte_cnt' $ wso "", 'bio_cnt' $ wso "", 'gpg_cnt' $ wso "", 'bio_lim' $ wso "", 'page_flts' $ wso "", 'buf_io' $ wso "", 'page_fil_cnt' $ wso "", 'byt_cnt' $ wso "", 'page_fil_Quota' $ wso "", 'byt_lim' $ wso "", 'proc_pg_cnt' $ wso "", 'cpu_lim' $ wso "", state $ wso "", 'cpu_tim' $ wso "", 'ws_auth' $ wso "", 'df_pfc' $ wso "", 'ws_auth_ext' $ wso "", 'df_ws_cnt' $ wso "", 'ws_ext' $ wso "", 'dio_cnt' $ wso "", 'ws_peak' $ wso "", 'dio_lim' $ wso "", 'ws_quota' $ wso "", 'dir_io' $ wso "", 'ws_size' $ wso "", 'fil_cnt' $ wso "", 'fil_lim' $ wso "", 'ast_cnt' $ wso "", 'ast_lim' $ wso "", 'ast_act' $ wso "", 'ast_en' $ wso "", 'page_fil_size' $ wso "", 'page_fil_free' $ wso "", 'swap_fil_size' $ wso "", 'swap_fil_free' $ wso "", free_p0 $ wso "", free_p1 $ wso "", image_name $ Return $! $!----------------------------------------------------------------------------- $! Subroutine to display data in a file $!----------------------------------------------------------------------------- $! $ dsply_file_rtn: $! $ wsf = "write outfile" $! $ wsf "Process Name : ''curr_proc_name'" $ timestamp = f$time() $ wsf "Current time : ",timestamp $ wsf "COMMENT : ''comment'" $! $ wsf "Active Page Table Count (apt_cnt) : ",'apt_cnt' $ wsf "Pages Avail for Vir Mem Exp (fre_pte_cnt) : ",'fre_pte_cnt' $! $ wsf "Remaining Buffered IO Quota (bio_cnt) : ",'bio_cnt' $ wsf "Buffered IO Limit Quota (bio_lim) : ",'bio_lim' $ wsf "Buffered IO's (buf_io) : ",'buf_io' $ wsf "Rem Buffered IO BytCnt Quota (byt_cnt) : ",'byt_cnt' $ wsf "Buffered IO Byte Limit Quota (byt_lim) : ",'byt_lim' $! $ wsf "Global Page Count (gpg_cnt) : ",'gpg_cnt' $ wsf "Page Faults (page_flts) : ",'page_flts' $ wsf "Def Page Fault Cluster Size (df_pfc) : ",'df_pfc' $! $ wsf "Remaining Page File Quota (page_fil_cnt) : ",'page_fil_cnt' $ wsf "Page File Quota (page_fil_quota) : ",'page_fil_Quota' $ wsf "Process Page Count (proc_pg_cnt) : ",'proc_pg_cnt' $! $ wsf "Limit on Process CPUtime (cpu_lim) : ",'cpu_lim' $ wsf "State (state) : ''state'" $ wsf "CPU Time (cpu_tim) : ",'cpu_tim' $! $ wsf "Max Auth W/S Size (ws_auth) : ",'ws_auth' $ wsf "Max Auth W/S Ext (ws_auth_ext) : ",'ws_auth_ext' $ wsf "Def W/S Size (df_ws_cnt) : ",'df_ws_cnt' $ wsf "Current W/S Size Ext (ws_ext) : ",'ws_ext' $ wsf "W/S Peak (ws_peak) : ",'ws_peak' $ wsf "W/S Size Quota (ws_quota) : ",'ws_quota' $ wsf "Process Current W/S Size (ws_size) : ",'ws_size' $! $ wsf "Remaining Direct IO Count (dio_cnt) : ",'dio_cnt' $ wsf "Direct IO Limit Quota (dio_lim) : ",'dio_lim' $ wsf "Direct IO's (dir_io) : ",'dir_io' $! $ wsf "Remaining Open File Quota (fil_cnt) : ",'fil_cnt' $ wsf "Open File Quota (fil_lim) : ",'fil_lim' $ wsf "Remaining AST quota (ast_cnt) : ",'ast_cnt' $ wsf "AST limit (ast_lim) : ",'ast_lim' $ wsf "Active ASTs (ast_act) : ",'ast_act' $ wsf "Enabled ASTs (ast_en) : ",'ast_en' $ WSF "FREEP0VA : ''free_p0'" $ WSF "FREEP1VA : ''free_p1'" $ wsf "" $ wsf "# of Free/Total Pages in PAGEFILE.SYS : ",'page_fil_free',"/"',- 'page_fil_size' $ wsf "# of Free/Total Pages in SWAPFILE.SYS : ",'swap_fil_free',"/",- 'swap_fil_size' $ wsf "Active Image_name : ''image_name'" $ wsf "" $ wsf "" $ wsf "" $ wsf "" $ wsf "" $! $ return $! $!---------------------------------------------------------------------------- $! Exit routine $!---------------------------------------------------------------------------- $ exit_rtn: $ if usefile then close outfile $ exit