U0012@DGOGWDG5.BITNET ("GWDGV1::MOELLER") (08/04/88)
the following little MACRO subroutine returns the time (in seconds) for which a particular process has been inactive. it needs CMKRNL privilege and has been tested with VMS 4.x only. Wolfgang J. Moeller, GWDG, D-3400 Goettingen, F.R.Germany | Disclaimer ... Bitnet/Earn: U0012@DGOGWDG5 Phone: +49 551 201516 | No claim intended $!...................... Cut on the dotted line and save ...................... $! VAX/VMS archive file created by VMS_SHAR V-5.04-WJM 25-may-1988 $! which was written by Michael Bednarek (U3369429@ucsvc.dn.mu.oz.au) $! and modified by W.J.Moeller <moeller@dgogwdg5.BITNET> $! To unpack, simply save and execute (@) this file. $! $! This archive was created by MOELLER $! on Thursday 4-AUG-1988 09:12:15.60 $! $! It contains the following 1 file: $! WAITIME.MAR $!============================================================================= $Set Symbol/Scope=(NoLocal,NoGlobal) $Version=F$GetSYI("VERSION") $If Version.ges."V4.4" then goto Version_OK $Write SYS$Output "Sorry, you are running VMS ",Version, - ", but this procedure requires V4.4 or higher." $Exit 44 $Version_OK:CR[0,8]=13 $Pass_or_Failed="failed!,passed." $Goto Start $Convert_File: $Read/Time_Out=0/Error=No_Error1/Prompt="creating ''File_is'" SYS$Command ddd $No_Error1:Define/User_Mode SYS$Output NL: $Edit/TPU/NoSection/NoDisplay/Command=SYS$Input/Output='File_is' - VMS_SHAR_DUMMY.DUMMY f:=Get_Info(Command_Line,"File_Name");b:=Create_Buffer("",f); o:=Get_Info(Command_Line,"Output_File");Set(Output_File,b,o); Position(Beginning_of(b));a:=0;Loop ExitIf Mark(None)=End_of(b); x:=Erase_Character(1);if x="V" then i:=LENGTH(CURRENT_LINE); if i<>78 then MOVE_HORIZONTAL(i);if i>78 then ERASE_CHARACTER(78-i);endif; if i<78 then COPY_TEXT(FAO("!#* ",78-i));endif; Move_Horizontal(-Current_Offset);endif;endif;if a then Append_Line; Move_Horizontal(-Current_Offset);endif;a:=(x="V");Move_Vertical(1);EndLoop; POSITION(BEGINNING_OF(b));p:=" "&LINE_END;loop x:=SEARCH(p,Forward,Exact); exitif x=0;POSITION(END_OF(x));s:=CURRENT_LINE;EDIT(s,Trim_trailing,Off); ERASE_CHARACTER(LENGTH(s)-CURRENT_OFFSET);endloop;Position(Beginning_of(b)); Loop x:=Search("`",Forward,Exact);ExitIf x=0;Position(x);Erase_Character(1); If Current_Character='`' then Move_Horizontal(1);else Copy_Text(ASCII(INT(Erase_Character(3))));EndIf;EndLoop;Exit; $Delete VMS_SHAR_DUMMY.DUMMY;* $Checksum 'File_is $Success=F$Element(Check_Sum_is.eq.CHECKSUM$CHECKSUM,",",Pass_or_Failed)+CR $Read/Time_Out=0/Error=No_Error2/Prompt=" CHECKSUM ''Success'" SYS$Command ddd $No_Error2:Return $Start: $File_is="WAITIME.MAR" $Check_Sum_is=1583355882 $Copy SYS$Input VMS_SHAR_DUMMY.DUMMY X`009.title`009waitime`009`009epid => pcb$l_waitime X; X;`009integer function waitime(epid) X;`009integer epid X;`009... returns (exe$gl_abstim - pcb$l_waitime) or signals X; X;***** X; X`009.library`009"SYS$LIBRARY:LIB" X`009$ipldef X`009$pcbdef X; X; X;***** X; X`009.entry`009waitime,^m<> X; X`009pushl`009@1*4(ap) X`009pushl`009#1 X`009$cmkrnl_s`009routin=k_waitime,arglst=(sp)`009 X`009blbs`009r0,11$ X`009pushl`009r0 X`009calls`009#1,g^lib$stop X11$: X`009movl`009r1,r0 X`009ret`009`009`009`009; return (value or status) X; X; X;***** X; Xk_waitime:`009.word`009^m<r2,r3,r4,r5> X; X`009movab`009g^lib$sig_to_ret,(fp) X; X`009movl`0094*1(ap),r0`009`009;r0 = epid X; X;***************************************** X;`009`009`009`009`009;* X`009setipl`00980$`009`009`009;* X;`009`009`009`009`009;* X`009jsb`009g^exe$epid_to_pcb`009;* r0 => pcb X`009beql`00921$`009`009`009;* br if bad epid X;`009`009`009`009`009;* X`009movl`009pcb$l_waitime(r0),r1`009;* r1 = pcb value (seconds since boot) X21$:`009`009`009`009`009;* X`009setipl`009#0`009`009`009;* X;`009`009`009`009`009;* X`009brb`00981$`009`009`009;* X;`009`009`009`009`009;* X80$:`009.long`009ipl$_synch`009`009;* X;`009`009`009`009`009;* X;***************************************** X; X81$: X`009tstl`009r0`009`009`009;bad pid? X`009bneq`00982$`009`009`009;br if no X`009clrl`009r1`009`009`009;result = 0 X`009brb`00990$ X82$: X`009subl3`009r1,g^exe$gl_abstim,r1`009;r1 = (positive) time difference X90$: X`009movl`009#1,r0 X`009ret X; X; X`009.end $GoSub Convert_File $Exit