Trailing-Edge
-
PDP-10 Archives
-
decuslib20-07
-
decus/20-0172/timing.t10
There is 1 other file named timing.t10 in the archive. Click here to see a list.
!<BLF/remark:9>
!<BLF/lowercase_user>
!<BLF/uppercase_key>
MODULE timing ( !
%IF %BLISS (BLISS32)
%THEN
ADDRESSING_MODE (EXTERNAL = LONG_RELATIVE, !
NONEXTERNAL = LONG_RELATIVE) ,
%FI
IDENT = '01'
) =
BEGIN
!++
! Facility:
!
! BLISS utilities
!
! Abstract:
!
! This module provides tools for measuring and recording times:
! CPU time of execution of a program, and
! wall-clock time of execution of a program.
!
! Environment:
!
! Currently, BLISS36 on DECsystem 10 only.
!
!--
!<BLF/page>
!
! Table of contents:
!--
FORWARD ROUTINE !
tim$format,
tim$set_clocks : NOVALUE,
tim$_read_cpu,
tim$read_wall;
!
! Include files:
!--
!
! Macros:
!--
BUILTIN
machop,
machskip;
MACRO
calli [] =
machop(%O'047', %REMAINING) %;
MACRO
mstime (qq) =
calli(qq, %O'23') %,
runtime (qq) =
calli(qq, %O'27') %;
!
! Equated symbols:
!--
LITERAL
true = 1 EQL 1,
false = 1 NEQ 1;
!
! Own storage:
!--
OWN
t_cpu,
t_wall;
!
! External references:
!--
EXTERNAL ROUTINE
cvt$put_dec;
GLOBAL ROUTINE tim$format (value, cptr) =
!
! FUNCTION
! Output a time-value to the character position given by 'cptr'
! in the format mm:ss.hh
!
! Inputs:
! value - a time, expressed in milliseconds
! cptr - a character pointer for the output string.
!
! Outputs:
! Returns a character pointer to the next position available.
!
BEGIN
LOCAL
ptr,
temp,
time;
time = .value;
ptr = .cptr;
IF .time LSS 0 ! Crossing over midnight?
THEN
time = .time + (24*60*60*1000);
time = (.time + 5)/10; ! Round to hundredths of secs.
temp = .time MOD 6000; ! Get seconds * 100.
ptr = cvt$put_dec (.time/6000, 2, .ptr); ! Output minutes.
CH$WCHAR_A (%C':', ptr);
ptr = cvt$put_dec (.temp/100, 2, .ptr); ! Output seconds.
CH$WCHAR_A (%C'.', ptr);
RETURN cvt$put_dec (.temp MOD 100, 1, .ptr); ! Output hundredths.
END; ! End of routine 'tim$format'
GLOBAL ROUTINE tim$set_clocks : NOVALUE =
!
! FUNCTION
! Set the initial time of day and runtime
!
! Inputs:
! None
!
! Outputs:
! None
!
BEGIN
REGISTER
r;
mstime (r);
t_wall = .r;
r = 0;
runtime (r);
t_cpu = .r;
END; ! End of routine 'tim$set_clocks'
GLOBAL ROUTINE tim$read_wall =
!
! FUNCTION:
! Return the elapsed time of day, from the last call to
! either tim$set_clocks or to this routine.
!
! Inputs:
! None
!
! Outputs:
! The integer elapsed time-of-day in Milliseconds
!
BEGIN
REGISTER
r;
mstime (r);
RETURN t_wall = .r - .t_wall;
END; ! End of routine 'tim$read_wall'
GLOBAL ROUTINE tim$_read_cpu =
!
! FUNCTION:
!
! Return the incremental CPU runtime, from the last call
! to this routine or to tim$set_clocks.
!
! Inputs:
! None
!
! Outputs:
!
! The integer elapsed CPU time in Milliseconds
!
BEGIN
REGISTER
r;
r = 0;
runtime (r);
RETURN t_cpu = .r - .t_cpu;
END; ! End of routine 'tim$_read_cpu'
%TITLE 'Last page of TIMING.BLI'
END ! End of module 'TIMING'
ELUDOM