Simple example to show accuracy of timing code when the task at hand does nothing more than sleep for a fixed length of time. More...
#include <time.h>
Functions | |
int | select () |
Provided method by the operating system. | |
int | nap () |
Sleep for a fixed length of delay time. | |
void | prepareInput () |
Prepare the input by building structure to sleep for designated time. | |
void | execute () |
Execute by invoking malloc(numElements) a total of numT times. | |
void | postInputProcessing () |
Nothing special. | |
void | problemUsage () |
No specific problem usage. | |
Variables | |
struct { | |
long tv_sec | |
long tv_usec | |
} | delay |
Equivalent of the 'timeval' structure. | |
int | numElements |
Length of time is based on the externally provided numElements. |
Simple example to show accuracy of timing code when the task at hand does nothing more than sleep for a fixed length of time.
http://www.faqs.org/faqs/unix-faq/faq/part4/section-6.html
void execute | ( | ) |
Execute by invoking malloc(numElements) a total of numT times.
.numElements
output sum to be sure is correct.
int nap | ( | ) |
Sleep for a fixed length of delay time.
void postInputProcessing | ( | ) |
Nothing special.
void prepareInput | ( | ) |
Prepare the input by building structure to sleep for designated time.
void problemUsage | ( | ) |
No specific problem usage.
int select | ( | ) |
Provided method by the operating system.
struct { ... } delay [static] |
Equivalent of the 'timeval' structure.
int numElements |
Length of time is based on the externally provided numElements.
Note: This behavior is unusual. You have been warned.
long tv_sec |
long tv_usec |
Algorithm Development Kit 1.0