Returns the number of CPU seconds used.
#include <imsls.h>
double imsls_ctime ()
The number of CPU seconds used by the program.
The CPU time needed to compute
is obtained and printed. The time needed is machine dependent. The CPU time needed will varies slightly from run to run on the same machine.
#include <imsls.h>
int main()
{
int k;
double sum, time;
/* Sum 1 million values */
for (sum=0, k=1; k<=1000000; k++)
sum += k;
/* Get amount of CPU time used */
time = imsls_ctime();
printf("sum = %f\n", sum);
printf("time = %f\n", time);
}
sum = 500000500000.000000
Visual Numerics, Inc. PHONE: 713.784.3131 FAX:713.781.9260 |