↑ Software ↑


bmw_util - Benchmarking Utilities

The BMW utilities provide a simple means of measuring the performance of an arbitrary task, where the measure is the number of something performed per second. For example, the following program measures the performance of standard output in number of lines per second:

    #include  <stdio.h>				-- Standard I/O definitions.
    #include  "bmw_util.h"			-- Benchmarking definitions.

    int  main (int argc, char *argv[])
        BmwClock  clock ;
        int  i, num_lines ;

        num_lines = atoi (argv[1]) ;

        bmwStart (&clock) ;
        for (i = 0 ;  i < num_lines ;  i++)
            printf ("Hello, World!\n") ;
        bmwStop (&clock) ;

        printf ("%g lines per second.\n",
                bmwRate (&clock, (long) num_lines)) ;

Public Procedures

bmwElapsed() - returns the elapsed time for a timer as a floating-point number of seconds.
bmwElapsedTV() - returns the elapsed time for a timer as a UNIX timeval structure (seconds and microseconds).
bmwRate() - computes the rate (# of X per second) for a timer.
bmwStart() - starts a timer.
bmwStop() - stops a timer.

Source Files


(See libgpl for the complete source, including support routines and build files.)

Alex Measday  /  E-mail