#define _GNU_SOURCE
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/time.h>
#include <unistd.h>
#include <ctype.h>
#include "lsfpu.c"
#include "lsmem.c"
#include "lsalu.c"
#include "lscompile.c"
#include "lsmedia.c"
#include "lscompress.c"
#include <math.h>       /* for sin, exp etc.           */
#include <stdio.h>      /* standard I/O                */
#include <string.h>     /* for strcpy - 3 occurrences  */
#include <stdlib.h>     /* for exit   - 1 occurrence   */
#include <time.h>

void title() {
        printf("\tLSBENCH is a product of the linuxsociety team\n");
        printf("\tThis is version beta-0.0.8 dated 03/04/2007\n");
        printf("\tIt is not recommended that you run this benchmark on systems with less than 64MB of physical memory\n\n");
return;
}

int main() {
        title();
        printf("\nRunning Memory tests (3 for now):\n");
        memtests();
        printf("\nRunning FPU tests (6 for now):");
        Section1();
	Problem0();
	Problem1();
	printf("\nRunning Compiler tests:\n");
	sleep (5);
	Compile1();
	printf("\tdone.\n");
	printf("\nRunning Media conversion tests:\n");
	Media1();
	printf("\tdone.\n");
        printf("\nRunning Compression/Archiving tests:\n");
        Compress1();
        printf("\tdone.\n");
	lsalu = (prob1 + prob0) / 80000;
        lsfpu = pass0 / 1200000 / 8.5;
	lscomp = comp1 * 1.2;
	lsmedia = media1 * 20;
        lscompress = compress1 * 30;
        printf("\n\nLSBENCH Results:\n");
        printf("\tMemory index:     %.3f \n", lsmem);
        printf("\tFPU index:        %lf\n", lsfpu);
	printf("\tALU index:        %lf\n", lsalu);
	printf("\tCompile index:    %lf\n", lscomp);
	printf("\tMedia index:      %lf\n", lsmedia);
	printf("\tCompression index:      %lf\n\n", lscompress);
        return 0;
}

