Because the NASD tree is a research prototype, it is often desirable
to measure time elapsed between two points. NASD provides a portable
interface for doing so. Use of the timer mechanism requires initialization
of the threads module. The basic type of
timer for measuring elapsed time between two points is nasd_timer_t
.
To start such a timer running, call NASD_TM_START()
with a
pointer to the nasd_timer_t
. To stop it, call NASD_TM_STOP()
with a pointer to the nasd_timer_t
. To determine how much
time elapsed between start and stop, call NASD_TM_ELAPSED_TS()
with two arguments: the first, a pointer to the nasd_timer_t
,
and the second, a pointer to a nasd_timespec_t
, which will
be initialized to the time elapsed between start and stop.
Example:
NASD_TM_STOP_ACCUM_TS()
is also provided. This takes two arguments: the first, a pointer to the nasd_timer_t
,
and the second, a pointer to a nasd_timespec_t
.
NASD_TM_STOP_ACCUM_TS()
stops a running timer, evaluates how much time
elapsed between start and stop, and adds that amount of time to the
timespec pointed to by the second argument.
Example:
nasd_multitimer_t
in place of a nasd_timer_t
.
The same operations that work on a nasd_timer_t
work on
a nasd_multitimer_t
, but two additional operations
are defined as well. NASD_TM_CKPT()
takes as its sole argument
a pointer to a nasd_multitimer_t
, and records a timestamp
as well as the source filename and line number where the checkpoint
occurred. NASD_TM_REPORT()
takes a pointer to a
nasd_multitimer_t
, and prints the filename and line number
of the start, stop, and each checkpoint, as well as the time elapsed between
each of these points.
Example:
![]() | ![]() | ![]() |
---|---|---|
Time | Delays | NASD Programmer's Documentation |