clock

Determines the CPU time (in 10-millisecond units) used since the beginning of the process. The time reported is the sum of the user and system times of the calling process and any terminated child processes for which the calling process has executed wait or system.

Format

#include  <time.h>

clock_t clock  (void);

Description

The value returned by the clock function must be divided by the value of the CLK_TCK, as defined in the standard header file <time.h>, to obtain the time in seconds.

The type clock_t is defined in the <time.h> header file as follows:

typedef long int clock_t;

Only the accumulated times for child processes running a C main program or a program that calls VAXC$CRTL_INIT or DECC$CRTL_INIT are included.

A typical usage of the clock function is to call it after a program does its initial setup, and then again after the program executes the code to be timed. Then subtract the two values to give elapsed CPU time.

Return Values
The processor time used. 
-1  Indicates that the processor time used is not available. 


Previous Page | Next Page | Table of Contents | Index