;/* acf4:comp.os.vms / mdchaney@bronze.ucs.indiana.edu (M Darrin Chaney) / 4:51 pm Nov 26, 1990 */ ;In article PBRADLEY@VAX1.TRINCOLL.EDU (Pete Bradley) writes: ;>Arne, you're almost there. Here's some code that worked for me and it's a *lot* ;>cheaper than Kernel mode calls. By the way, if MACRO isn't your bag, this same ;>function can be done in just about any language (I originally did this in PL/I) ;>with a little tweaking. Hope this helps! ; ;(small program deleted) ; ;This correct. However, note that the time value that you get from here is ;in a longword format, and VMS system time is in a quadword format. To get to ;the quadword format, simply multiply by #100000. Here is a small program to ;show your total CPU time for the current process (again in macro): ; ;=============================================================================== ; .Title CPU_Time Program to show process total CPU time .Library 'Sys$Library:Lib.MLB' .Link 'Sys$System:Sys.STB'/Selective_Search $PHDDef QuadTime: .Quad 0 ;This will hold the quadword time CPUTime: .Long 0 ;This will hold the longword time OutDes: .Long 23 ;This will be our output buffer .Address OutBuf OutBuf: .BlkB 23 .Entry Try,^M<> MovL CTL$GL_PHD,R0 ;Get the address of the PHD window MovL PHD$L_CPUTIM(R0),CPUTime ;Get the CPU Time EMul #-100000,CPUTime,#0,QuadTime ;Change from long to quad format ;I'm negating it so that $ASCTIM ;will treat it as a delta time. $ASCTim_S TimBuf=OutDes, - ;change from quadword to ascii format TimLen=OutDes, - ;the length address TimAdr=QuadTime, - ;address of quadword time value CvtFlg=#1 ;the convert flag (see manual for values) BLBC R0,Bye ;branch here if there were problems PushAQ OutDes ;Prepare to print this string CallS S^#1,G^Lib$Put_Output ;and print it... Bye: Ret ;return with Status .End Try ;=============================================================================== ; ;When you run this program, it will print to the screen your cpu time. If you ;want to make a nice output, FAO is definitely something to consider. Note ;also that the only reason I multiply by -100000 is so that it will be in the ;delta time format when converted by $asctim. If I didn't care about that, I'd ;simply multiply by 100000. If I sent the positive number to $asctim, it would ;give me the date (cputime + midnight, Nov 17, 1858). ; ;And, to re-enforce what Pete said: it's quicker to do it this way than to call ;$GetJPI. It's also easier. Although the threat is there that this could ;change at anytime, I don't foresee it anywhere in the near future. ; ; Darrin ; ;mdchaney@iubacs ;mdchaney@bronze.ucs.indiana.edu ;mdchaney@rose.ucs.indiana.edu ;/* ---------- */ ;