---
name: "Timer"
section: "3"
platform: "linux"
package: "libvolpack1-dev"
version: "1.0b3-10"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Timer"
---

# Timer(3)

interval timer facility

## NAME

vpGetTimer, vpClearTimer - interval timer facility

## SYNOPSIS

\#include \<volpack.h\>

vpResult

**vpGetTimer(***vpc, option, iptr***)**

-

  vpContext \**vpc;*

-

  int *option;*

-

  int \**iptr;*;

vpResult

**vpClearTimer(***vpc, option***)**

-

  vpContext \**vpc;*

-

  int *option;*

## ARGUMENTS

- *vpc*

  VolPack context from **vpCreateContext.**

- *option*

  Constant that specifies a particular timer.

- *iptr*

  Location for storing the timer value.

## DESCRIPTION

These functions are used for measuring the performance of the VolPack library.  To use them, the library must be compiled with a special flag: either -DHAVE\_LORES\_TIMER (for machine that support the gettimeofday C library call) or -DHAVE\_HIRES\_TIMER (for SGI machines that support high-resolution memory-mapped I/O timers; on a Challenge or ONYX, the -DHAVE\_64BIT\_TIMER must also be specified).  If one of these flags is specified at compile time then VolPack maintains a table recording the accumulated time spent in various operations. Note that some of the operations can only be timed with a high-resolution timer; time values will not be recorded and will appear to be zero if a low resolution timer is specified at compile time.

**vpGetTimer** retrieves the accumulated time for a particular operation.  The *option* argument specifies which operation:

- VPTIMER\_SHADE

  Time the routine that computes the contents of the shading lookup table.

- VPTIMER\_RENDER

  Time the routine that renders a volume (includes VPTIMER\_CLSFY\_OCTREE, VPTIMER\_COMPOSITE, VPTIMER\_DEPTHCUE, and VPTIMER\_WARP).

- VPTIMER\_COMPOSITE

  Time the routine that computes the intermediate image from the volume (includes VPTIMER\_CLEAR, VPTIMER\_TRAVERSE\_OCTREE, VPTIMER\_ERT, VPTIMER\_TRAVERSE\_RUNS, and VPTIMER\_PROCESS\_VOXELS).

- VPTIMER\_DEPTHCUE

  Time the routine that performs the depth cueing fixup on the intermediate image.

- VPTIMER\_WARP

  Time the routine that warps the intermediate image into the final image.

- VPTIMER\_TRAVERSE\_RUNS

  Time the portion of the compositing routine devoted to traversing the volume data structures.

- VPTIMER\_PROCESS\_VOXELS

  Time the portion of the compositing routine devoted to compositing voxels into the intermediate image.

- VPTIMER\_ERT

  Time the early-ray termination checks during compositing.

- VPTIMER\_CLSFY\_OCTREE

  Time the octree classification stage.

- VPTIMER\_TRAVERSE\_OCTREE

  Time the portion of the compositing routine devoted to traversing the octree.

- VPTIMER\_CLEAR

  Time the routine that clears the intermediate image at the beginning of compositing.

The routine stores the accumulated time since the last call to *vpClearTimer* (or since the beginning of the program) in the location specified by *iptr.*  The units of the value are microseconds.

*vpClearTimer* sets the specified timer value back to zero.

## ERRORS

The normal return value is VP\_OK.  The following error return value is possible:

- VPERROR\_BAD\_OPTION

  The *option* argument is invalid.

## SEE ALSO

[VolPack(3)](/VolPack/3.md), vpCreateContext(3)
