timer:show-time
List of: Scheme Extensions
Subjects: Debugging
Contents: Kernel

Action: Calculates and returns the amount of time elapsed since the timer:start command was executed. This is most often used to measure performance.

Filename: kern/kern_scm/law_scm.cxx

Syntax: (timer:show-time)

Returns: real

Description: The commands timer:start, timer:end, timer:get-time and timer:show-time are used to measure performance of some command or series of commands. This feature measures only the CPU time required to execute the command and not any delays incurred from entering the commands into Scheme or any other interference or condition.


timer:show-time can be executed/interspersed any number of times throughout a command or series of commands.


timer:show-time returns a real number only after timer:start is executed. If timer:start has not been executed, timer:show-time returns zero (0).


You can also use timer:get-time to display the amount of time elapsed since timer:start was executed.

Example: ; timer:show-time

; Start the timer

(timer:start)

;; "timer on"

; Create a solid block

(define blockA (solid:block (position 0 0 0)


(position 20 20 20)))

;; blockA

; Create another solid block

(define blockB (solid:block (position 0 0 0)


(position -20 -20 -20)))

;; blockB

; Set color for blockB

(entity:set-color blockB 7)

;; ()

;show how much time has passed.

(timer:show-time)

;; Elapsed time = 33.989

;; 356.722

; Create a third solid block

(define blockC (solid:block (position 0 0 0)


(position 40 40 40)))

;; blockC

; Set color for blockB

(entity:set-color blockC 4)

;; ()

;turn timer off.

(timer:end)

;; "timer off, use timer:get-time"

(timer:get-time)

;; 4.556
PDF/KERN/15SCR.PDF
HTM/DATA/KERN/KERN/15SCR/0035.HTM