Timing/timing.c File Reference

Common driver to launch many experiments. Implements a standard driver for processing command line arguments to retrieve (a) the number of elements; (b) the verbose setting; (c) the randomized seed to use to enable repeated experiments. More...

#include <string.h>
#include <stdlib.h>
#include <sys/time.h>
#include <getopt.h>
#include <stdio.h>
#include "problem.h"
#include "report.h"

Functions

void problemUsage ()
 No specific problem usage.
void execute ()
 Execute by invoking malloc(numElements) a total of numT times.
void reportUsage ()
 No special usage.
void report (long usecs)
 Standard reporting system.
void prepareInput (int inputSize, int argc, char **argv)
 Construct a random string of size ssize and have 'str1' and 'str2' be allocated strings with the same contents.
void postInputProcessing (long usecs)
 Report properly formatted for table.
void usage ()
 Sets up a timing framework.
int main (int argc, char **argv)
 Execute with given flags.

Variables

int verbose = 0
 Whether run is to be executing in verbose mode.
int numElements = 100000
 Most important parameter is the number of elements selected.


Detailed Description

Common driver to launch many experiments. Implements a standard driver for processing command line arguments to retrieve (a) the number of elements; (b) the verbose setting; (c) the randomized seed to use to enable repeated experiments.

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 main ( int  argc,
char **  argv 
)

Execute with given flags.

-h HELP -n N Number of elements being processed -v Compute in verbose mode -s S Set the initial random seed for all computationsn

Time before process starts.

Time after process completes.

void postInputProcessing ( long  usecs  ) 

Report properly formatted for table.

void prepareInput ( int  size,
int  argc,
char **  argv 
)

Construct a random string of size ssize and have 'str1' and 'str2' be allocated strings with the same contents.

use character-swapping algorithm from strfry.c in glibc

http://www.koders.com/c/fidBD83E492934F9F671DE79B11E6AC0277F9887CF5.aspx

terminate at word boundary, not including spaces.

void problemUsage (  ) 

No specific problem usage.

void report ( long  usecs  ) 

Standard reporting system.

Parameters:
usecs absolute time amount.

void reportUsage (  ) 

No special usage.

void usage (  ) 

Sets up a timing framework.

To use, you need to provide the following functions:

prepareInput(int inputSize);

execute();

report();


Variable Documentation

int numElements = 100000

Most important parameter is the number of elements selected.

Note: This behavior is unusual. You have been warned.

int verbose = 0

Whether run is to be executing in verbose mode.

Algorithm Development Kit 1.0