Timing/benchmark.c File Reference

Task to sleep for fixed length of time

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.


Detailed Description

Task to sleep for fixed length of time

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

Author:
George Heineman
Date:
6/15/08

Function Documentation

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.


Variable Documentation

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