Writing Your Own Clock Function - Texas Instruments TMS320C2x User Manual

Optimizing c compiler digital signal processor
Hide thumbs Also See for TMS320C2x:
Table of Contents

Advertisement

clock
clock
Syntax
Defined in
Description
cos
Syntax
Defined in
Description
Example
7-28
Processor Time
#include <time.h>
clock_t clock(void );
clock.c in rts.src
The clock function determines the amount of processor time used. It returns
an approximation of the processor time used by a program since the program
began running. The time in seconds is the return value divided by the value
of the macro CLOCKS_PER_SEC.
If the processor time is not available or cannot be represented, the clock func-
tion returns the value of −1.
Note: Writing Your Own Clock Function
The clock function is target-system specific, so you must write your own
clock function. You must also define the CLOCKS_PER_SEC macro accord-
ing to the units of your clock so that the value returned by clock( ) (number
of clock ticks) can be divided by CLOCKS_PER_SEC to produce a value in
seconds.
For more information about the functions and types that the time.h header
declares and defines, see section 7.2.12, Time Function (time.h) on page 7-11.
Cosine
#include <math.h>
double cos(double x );
cos.c in rts.src
The cos function returns the cosine of a floating-point number x. The angle x
is expressed in radians. An argument with a large magnitude might produce
a result with little or no significance.
double radians, cval;
radians = 3.1415927;
cval = cos(radians);
/* cos returns cval */
/* return value = −1.0 */

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tms320c2xxTms320c5x

Table of Contents