Index: trunk/src/emx/testcase/benchmarks/Makefile
===================================================================
--- trunk/src/emx/testcase/benchmarks/Makefile	(revision 801)
+++ trunk/src/emx/testcase/benchmarks/Makefile	(revision 801)
@@ -0,0 +1,116 @@
+# $Id$
+## @file
+#
+# Makefile for the benchmark.
+#
+# Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net>
+#
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with This program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+#
+
+
+ifdef USE_VAC
+#
+# VAC setup.
+#
+CCFLAGS			= /Ti- -O
+CCLD_STATIC 	= icc $(CCFLAGS) /Gd-
+CCLD_DYNAMIC 	= icc $(CCFLAGS) /Gd
+E				= .exe
+O				= .obj
+TRG				= /Fo$@
+endif
+
+ifdef USE_EMX
+#
+# EMX setup.
+#
+CCFLAGS			= -s -O2 -Zomf
+CCLD_STATIC 	= gcc $(CCFLAGS)
+CCLD_DYNAMIC 	= gcc $(CCFLAGS) -Zcrtdll
+E				= .exe
+O				= .o
+TRG				= -o $@
+endif
+
+ifdef USE_LINUX
+#
+# Linux GCC setup.
+#
+CCFLAGS			= -s -O3
+CCLD_STATIC 	= gcc $(CCFLAGS) -static
+CCLD_DYNAMIC 	= gcc $(CCFLAGS)
+E				=
+O				= .o
+TRG				= -o $@
+endif
+
+
+ifndef TRG
+#
+# Innotek GCC setup.
+#
+CCFLAGS			= -s -O3 -Zomf
+CCLD_STATIC 	= gcc $(CCFLAGS) -static
+CCLD_DYNAMIC 	= gcc $(CCFLAGS)
+E				= .exe
+O				= .o
+TRG				= -o $@
+endif
+
+
+
+#
+# Main rules.
+#
+all: startup1 micro$E benchmark$E
+
+check: all
+	./benchmark$E
+
+clean:
+	rm -f startup1-static$E startup1-dynamic$E micro$E benchmark$E
+ifneq ($O,)
+	rm -f *$O
+endif	
+
+
+#
+# micro - calibrator.
+#			
+micro.exe: micro.asm
+	alp micro.asm
+	ilink micro.obj;
+
+#
+# startup1.c - static and dynamic version.	
+#
+.PHONY: startup1
+startup1: startup1-static$E startup1-dynamic$E
+
+startup1-static$E: startup1.c
+	$(CCLD_STATIC) $(TRG) $<
+startup1-dynamic$E: startup1.c
+	$(CCLD_DYNAMIC) $(TRG) $<
+
+
+#
+# Benchmark driver.
+#
+benchmark$E: benchmark.c PrfTiming.h
+	$(CCLD_DYNAMIC) $(TRG) benchmark.c
+
Index: trunk/src/emx/testcase/benchmarks/PrfTiming.h
===================================================================
--- trunk/src/emx/testcase/benchmarks/PrfTiming.h	(revision 800)
+++ trunk/src/emx/testcase/benchmarks/PrfTiming.h	(revision 801)
@@ -18,4 +18,5 @@
 
 #ifdef __OS2__
+#define INCL_BASE
 #define INCL_DOSPROFILE
 #include <os2.h>
Index: trunk/src/emx/testcase/benchmarks/benchmark.c
===================================================================
--- trunk/src/emx/testcase/benchmarks/benchmark.c	(revision 801)
+++ trunk/src/emx/testcase/benchmarks/benchmark.c	(revision 801)
@@ -0,0 +1,201 @@
+/* $Id$ */
+/** @file
+ *
+ * Benchmark Driver Program
+ *
+ *
+ * Copyright (c) 2001-2003 knut st. osmundsen <bird-srcspam@anduin.net>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with This program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+/*******************************************************************************
+*   Header Files                                                               *
+*******************************************************************************/
+#ifdef __OS2__
+#define INCL_BASE
+#endif
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include "PrfTiming.h"
+
+
+/** Number of seconds to sample a testcase where we count iterations. */
+#define SAMPLE_TIME     3.0
+
+
+/**
+ * Execute pszPgm using CRT methods for executing it.
+ *
+ * @returns Number of childs per minutte.
+ * @returns -1 on failure.
+ * @param   pszPgm  Program to execute.
+ * @param   pszMsg  Message to display before doing the execution.
+ */
+int CrtExecIterate(const char * pszPgm, const char *pszMsg)
+{
+    long double rdCur;
+    long double rdStart;
+    long double rdEnd;
+    unsigned    cChilds;
+    int         pid;
+#ifdef __NOTPC__
+    int         status;
+#endif
+
+    /*
+     * Message.
+     */
+    if (pszMsg)
+        printf(pszMsg);
+
+    /*
+     * Main process.
+     */
+    cChilds = 0;                        /* child count */
+    rdEnd = getHz() * SAMPLE_TIME;
+    rdEnd += rdStart = rdCur = gettime();
+    while (rdEnd > rdCur)
+    {
+#ifndef __NOTPC__
+        pid = spawnl(P_WAIT, pszPgm, pszPgm, NULL); /* pid == 0 on success */
+        if (pid < 0)
+        {
+            printf("spawnl failed for '%s'\n", pszPgm);
+            return -1;
+        }
+#else
+        pid = fork();
+        if (pid == 0)
+        {/* child code */
+            execl(pszPgm, pszPgm, NULL);
+            fprintf(stderr, "we should NEVER be here!!\n");
+            return -1;
+        }
+        if (pid > 0)
+            pid = wait(&status);
+#endif
+        cChilds++;
+        rdCur = gettime();
+    }
+
+    /*
+     * Result.
+     */
+    cChilds /= ((rdCur - rdStart) / getHz());
+    if (pszMsg)
+        printf("%d childs per second.\n", cChilds);
+
+    return cChilds;
+}
+
+/**
+ * Execute pszPgm using OS methods for executing it.
+ *
+ * @returns Number of childs per minutte.
+ * @returns -1 on failure.
+ * @param   pszPgm  Program to execute.
+ * @param   pszMsg  Message to display before doing the execution.
+ */
+int OSExecIterate(const char * pszPgm, const char *pszMsg)
+{
+    long double rdCur;
+    long double rdStart;
+    long double rdEnd;
+    unsigned    cChilds;
+    int         rc;
+    int         pid;
+#ifdef __NOTPC__
+    int         status;
+#endif
+
+    /*
+     * Message.
+     */
+    if (pszMsg)
+        printf(pszMsg);
+
+    /*
+     * Main process.
+     */
+    cChilds = 0;                        /* child count */
+    rdEnd = getHz() * SAMPLE_TIME;
+    rdEnd += rdStart = rdCur = gettime();
+    while (rdEnd > rdCur)
+    {
+#ifdef __OS2__
+        RESULTCODES res;
+        rc = DosExecPgm(NULL, 0, EXEC_SYNC, "micro.exe\0", NULL, &res, "micro.exe");
+        if (rc)
+        {
+            printf("failed! (rc=%d)\n", rc);
+            return 1;
+        }
+#elif defined(__NOTPC__)
+        pid = fork();
+        if (pid == 0)
+        {/* child code */
+            execl(pszPgm, pszPgm, NULL);
+            fprintf(stderr, "we should NEVER be here!!\n");
+            return -1;
+        }
+        if (pid > 0)
+            pid = wait(&status);
+#else
+#error "Not ported to this OS."
+#endif
+        cChilds++;
+        rdCur = gettime();
+    }
+
+    /*
+     * Result.
+     */
+    cChilds /= ((rdCur - rdStart) / getHz());
+    if (pszMsg)
+        printf("%d childs per second.\n", cChilds);
+
+    return cChilds;
+}
+
+
+
+int main(int argc, char **argv)
+{
+    setvbuf(stdout, NULL, _IONBF, 0); /* no buffering. */
+
+    /*
+     * Output some general stuff about this box.
+     */
+    printf("LIBC Benchmark v0.0.0\n");
+    printSystemInfo();
+
+    /*
+     * Do calibration.
+     */
+    OSExecIterate( "micro",                 "Calibration OS... ");
+    CrtExecIterate("micro",                 "Calibration CRT... ");
+
+    /*
+     * Do startup time tests.
+     */
+    CrtExecIterate("startup1-static",       "Startup - bare, static:  \t");
+    CrtExecIterate("startup1-dynamic",      "Startup - bare, dynamic: \t");
+
+    return 0;
+}
Index: trunk/src/emx/testcase/benchmarks/micro.asm
===================================================================
--- trunk/src/emx/testcase/benchmarks/micro.asm	(revision 801)
+++ trunk/src/emx/testcase/benchmarks/micro.asm	(revision 801)
@@ -0,0 +1,44 @@
+; $Id$
+;; @file
+;
+; The quickest possible executable testcase.
+; Used as reference.
+;
+; Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net>
+;
+;
+; This program is free software; you can redistribute it and/or modify
+; it under the terms of the GNU General Public License as published by
+; the Free Software Foundation; either version 2 of the License, or
+; (at your option) any later version.
+;
+; This program is distributed in the hope that it will be useful,
+; but WITHOUT ANY WARRANTY; without even the implied warranty of
+; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+; GNU General Public License for more details.
+;
+; You should have received a copy of the GNU General Public License
+; along with This program; if not, write to the Free Software
+; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+;
+;
+
+    .386
+
+CODE32 segment public para use32 'CODE'
+    ASSUME cs:FLAT, ds:FLAT, es:FLAT, ss:FLAT
+    public entry
+entry:
+    xor     eax, eax
+    ret
+CODE32 ends
+
+;DATA32 segment public para use32 'DATA'
+;DATA32 ends
+
+STACK32 segment stack para use32 'STACK'
+    db 4096 dup(?)
+STACK32 ends
+
+end entry
+
Index: trunk/src/emx/testcase/benchmarks/startup1.c
===================================================================
--- trunk/src/emx/testcase/benchmarks/startup1.c	(revision 801)
+++ trunk/src/emx/testcase/benchmarks/startup1.c	(revision 801)
@@ -0,0 +1,29 @@
+/* $Id$ */
+/** @file
+ *
+ * Startup no.1 - Smallest C program.
+ *                Only startup stuff, no extra stuff like file streams.
+ *
+ * Copyright (c) 2003 knut st. osmundsen <bird-srcspam@anduin.net>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with This program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ */
+
+int main()
+{
+    return 0;
+}
