Overview of the System Timer
Sept. 10, 2003 - BAM110 Lab


You are expected to add appropriate calls to the system timing routine, etime or dtime, to gain a "feeling" for techniques to access work and performance. (Note, we'll be working on this theme all semester long, this is just the first step.) You can get information on dtime from the man page: man dtime

In addition to the man page information on dtime, our text book (High Performance Computing by Kevin Dowd & Charles Severance) discusses the user time and system time information at the beginning of Ch. 6, pp. 105-6. We also look into sample codes (Fortran and C) Samples Using the System Timer from lab [10Sept03].

In case you're curious how I knew that this was the name of the appropriate system routine, I first used "man" to return information on all routines having anything to do with time using man -k time | more. Or I could use man -k time > temp to create the file temp. I then used the editor pico temp to examine this file and concluded that man dtime was the appropriate first place to look.

dtime returns the amount of "user" time and "system" time since the last time dtime was invoked. There is a related timer, call etime, for "elapsed" time

etime   dtime
 /-\     /-\
  |       |       Do something-1
  |       |
 \-/     \-/
etime   dtime
                  Dtime returns the "difference" of the CPU time
                  since last called.  Etime returns the elapsed
                  time.  In the situation outlined above, etime
                  has been invoked at the beginning and then
                  after "do something-1" is completed.  So the
                  initial values of etime (user time/system time)
                  must be stored and subtracted from the values
                  given the second time etime is used to give the
                  amount of time to "do something-1".
What can you expect to "see"? If we focus on the high order term of the operation count for the work, then using csample.c or fsample.f, the first task is expected to depend on the size of the input, N, and the second task is expected to be constant
          worktask1(N) ~= N       worktask2(N) ~= 1
So if one works with systems of size N=10, 20, 40, 80, 160, ..., one would expect to see the work change by a roughly constant factor for Task 1 and be mostly unchanged for Task 2. Therefore the ratio
worktask1(2N)
---------------- 
worktask1(N)
would be approximately constant.

You want to see when N is "large enough" for the high order term in the operation count to dominate.

You want to see when the arithmetic performed dominates the "other" tasks involved in the actual execution of a computer program. Other costs would be the time to call subroutines and compute addresses of variables.

You want to evaluate how helpful the system timer is in evaluating the performance of a code. Lab1 Xterm and Timer Intro [10Sept03]