aboutsummaryrefslogtreecommitdiffstats
path: root/test/ccured_olden/health
diff options
context:
space:
mode:
authorblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
committerblazy <blazy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2006-10-20 12:37:13 +0000
commitca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e (patch)
tree50a139db8e2ac51c6ff41f3790ff72aa417ed3be /test/ccured_olden/health
parent43668d9109b1f36329646fd07324d435be6f0050 (diff)
downloadcompcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.tar.gz
compcert-ca0c62265eb8cdd5fb0d8a8b34ee77baf3de987e.zip
Ajout du banc de tests de CCured (Olden benchmark suite, cf.
CCured: type-safe retrofitting of legacy code, G.Necula et al.) rapportCompcert_all.txt liste les erreurs produites par ccomp. git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@121 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'test/ccured_olden/health')
-rw-r--r--test/ccured_olden/health/.cvsignore30
-rw-r--r--test/ccured_olden/health/.gdbinit6
-rw-r--r--test/ccured_olden/health/CVS/Entries16
-rw-r--r--test/ccured_olden/health/CVS/Repository1
-rw-r--r--test/ccured_olden/health/CVS/Root1
-rw-r--r--test/ccured_olden/health/HOWTO1
-rw-r--r--test/ccured_olden/health/Makefile72
-rw-r--r--test/ccured_olden/health/README20
-rw-r--r--test/ccured_olden/health/args.c34
-rw-r--r--test/ccured_olden/health/health.c309
-rw-r--r--test/ccured_olden/health/health.h76
-rw-r--r--test/ccured_olden/health/list.c55
-rw-r--r--test/ccured_olden/health/out.orig64
-rw-r--r--test/ccured_olden/health/out.orig.msvc64
-rw-r--r--test/ccured_olden/health/output64
-rw-r--r--test/ccured_olden/health/poisson.c35
-rw-r--r--test/ccured_olden/health/ssplain.c70
-rw-r--r--test/ccured_olden/health/ssplain.h130
-rwxr-xr-xtest/ccured_olden/health/testit25
19 files changed, 1073 insertions, 0 deletions
diff --git a/test/ccured_olden/health/.cvsignore b/test/ccured_olden/health/.cvsignore
new file mode 100644
index 00000000..4d714a14
--- /dev/null
+++ b/test/ccured_olden/health/.cvsignore
@@ -0,0 +1,30 @@
+*.o
+*.obj
+*.exe
+*.pdb
+*.ilk
+*.cpp
+*.i
+*.s
+*.asm
+*cil.c
+*.rtl
+*box.c
+*infer.c
+*_ppp.c
+*.origi
+*.stackdump
+*_all.c
+changes.out
+health.cil
+health.*box
+health.exe_comb.browser
+health
+allcfiles
+ope.m
+*cured.c
+*.optim.c
+*_comb.c
+changes
+output
+out.diff
diff --git a/test/ccured_olden/health/.gdbinit b/test/ccured_olden/health/.gdbinit
new file mode 100644
index 00000000..ce03cd23
--- /dev/null
+++ b/test/ccured_olden/health/.gdbinit
@@ -0,0 +1,6 @@
+# .gdbinit
+
+file health
+set args 2 5 1
+break main
+run
diff --git a/test/ccured_olden/health/CVS/Entries b/test/ccured_olden/health/CVS/Entries
new file mode 100644
index 00000000..87bb1a82
--- /dev/null
+++ b/test/ccured_olden/health/CVS/Entries
@@ -0,0 +1,16 @@
+/.gdbinit/1.1/Sat Jul 21 16:09:41 2001//
+/HOWTO/1.1/Sat Jul 14 22:53:03 2001//
+/README/1.1/Mon Jun 11 22:47:26 2001//
+/health.h/1.3/Sat Jul 21 16:09:41 2001//
+/list.c/1.3/Sat Jul 21 16:09:41 2001//
+/poisson.c/1.2/Mon Jul 9 16:14:59 2001//
+/ssplain.c/1.5/Fri Nov 9 01:27:01 2001//
+/args.c/1.5/Mon Nov 12 15:44:12 2001//
+/health.c/1.7/Mon Nov 12 15:44:12 2001//
+/out.orig/1.2/Mon Nov 12 15:44:12 2001//
+/out.orig.msvc/1.1/Tue Dec 4 04:57:46 2001//
+/testit/1.2/Tue Dec 4 05:07:50 2001//
+/Makefile/1.11/Tue Dec 18 06:56:15 2001//
+/.cvsignore/1.14/Fri Oct 4 16:28:44 2002//
+/ssplain.h/1.5/Mon Jan 6 23:28:55 2003//
+D
diff --git a/test/ccured_olden/health/CVS/Repository b/test/ccured_olden/health/CVS/Repository
new file mode 100644
index 00000000..8167847a
--- /dev/null
+++ b/test/ccured_olden/health/CVS/Repository
@@ -0,0 +1 @@
+cil/test/olden/health
diff --git a/test/ccured_olden/health/CVS/Root b/test/ccured_olden/health/CVS/Root
new file mode 100644
index 00000000..35f411e9
--- /dev/null
+++ b/test/ccured_olden/health/CVS/Root
@@ -0,0 +1 @@
+/home/cvs-repository
diff --git a/test/ccured_olden/health/HOWTO b/test/ccured_olden/health/HOWTO
new file mode 100644
index 00000000..8f57aa46
--- /dev/null
+++ b/test/ccured_olden/health/HOWTO
@@ -0,0 +1 @@
+5 500 1 1
diff --git a/test/ccured_olden/health/Makefile b/test/ccured_olden/health/Makefile
new file mode 100644
index 00000000..d9c5c767
--- /dev/null
+++ b/test/ccured_olden/health/Makefile
@@ -0,0 +1,72 @@
+# /* For copyright information, see olden_v1.0/COPYRIGHT */
+
+BINARY = health.exe
+PROGS = health poisson list args ssplain
+
+# ------- msvc ------
+ifdef _MSVC
+CC = cl
+
+CFLAGS =
+CONLY = /c
+SRC = .c
+OBJ = .obj
+ASM = .s
+EXEOUT = /Fe
+
+EXTRA_CDEFS = /DI_TIME /DI_SYS_TIME /DULTRIX
+CDEFS = /DPLAIN /DSS_PLAIN
+ifdef _DEBUG
+OPTFLAGS = /Zi /MLd
+else
+OPTFLAGS = /Ox
+endif
+
+LIBS =
+LIBPATH =
+
+# ------- gcc ------
+else
+CC = gcc -arch ppc
+CCOMP=../../../../ccomp
+CCOMPFLAGS=-dump-c
+
+CFLAGS = -O3
+CONLY = -c
+SRC = .c
+OBJ = .gcc
+OBJCCOMP = .compcert
+ASM = .s
+
+EXTRA_CDEFS = -DI_TIME -DI_SYS_TIME -DULTRIX
+CDEFS = -DPLAIN -DSS_PLAIN
+OPTFLAGS = -g -Wall -O3
+EXEOUT = -gcc
+
+LIBS =
+LIBPATH =
+endif
+
+# ------- common --------
+
+all_s: $(PROGS:%=%.s)
+
+all: $(PROGS:%=%.compcert)
+
+all_gcc: $(PROGS:%=%.gcc)
+
+%.compcert: %.s
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.compcert $*.s $(LIBS)
+
+%.s: %.c ../../../../ccomp
+ $(CCOMP) $(CCOMPFLAGS) $*.c
+
+%.gcc: %.c
+ $(CC) $(CFLAGS) $(LDFALGS) $(OPTFLAGS) -o $*.gcc $*.c $(LIBS)
+
+
+clean:
+ rm -f $(BINARY) *.o *~ *.s *.light.c *.cil.* *.compcert
+
+
+
diff --git a/test/ccured_olden/health/README b/test/ccured_olden/health/README
new file mode 100644
index 00000000..aff90729
--- /dev/null
+++ b/test/ccured_olden/health/README
@@ -0,0 +1,20 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+**********************
+olden_v1.0/benchmarks/health/README
+January 3, 1995
+Martin C. Carlisle
+
+this directory contains the health benchmark:
+
+G. Lomow, J. Cleary, B. Unger and D. West. "A Performance Study of Time Warp"
+In SCS Multiconference on Distributed Simulation, pages 50-55, Feb. 1988.
+
+as implemented for Olden by Gordon C. Mackenzie
+**********************
+
+Makefile - use "make health" to create executable
+
+args.c - process command line args
+health.[ch] - health routines
+list.c - list routines
+poisson.c - random routines
diff --git a/test/ccured_olden/health/args.c b/test/ccured_olden/health/args.c
new file mode 100644
index 00000000..f8e7a8cc
--- /dev/null
+++ b/test/ccured_olden/health/args.c
@@ -0,0 +1,34 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/*****************************************************************
+ * args.c: Handles arguments to command line. *
+ * To be used with health.c. *
+ *****************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "health.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+void dealwithargs(int argc, char *argv[]) {
+
+ if (argc < 4)
+ {
+ fprintf(stderr, "usage: health <# levels> <time> <seed>\n");
+ exit(1);
+ }
+
+ max_level = atoi(argv[1]);
+ fprintf(stderr, "This is max_level : %d\n", max_level);
+ max_time = atol(argv[2]);
+ fprintf(stderr, "This is max_time : %ld\n", max_time); // sm: "%d" -> "%ld"
+ seed = atol(argv[3]);
+}
+
+
+
+
+
diff --git a/test/ccured_olden/health/health.c b/test/ccured_olden/health/health.c
new file mode 100644
index 00000000..6de1d0d7
--- /dev/null
+++ b/test/ccured_olden/health/health.c
@@ -0,0 +1,309 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/*******************************************************************
+ * Health.c : Model of the Colombian Health Care System *
+ *******************************************************************/
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include "health.h"
+#include <assert.h>
+
+struct Village *alloc_tree(int level, int label, struct Village *back)
+{
+ if (level == 0)
+ {
+ return NULL;
+ }
+ else
+ {
+ int i;
+ struct Village *new;
+
+ new = (struct Village *)malloc(sizeof(struct Village));
+
+ new->back = back;
+ new->label = label;
+ new->seed = label * (IQ + seed);
+ new->hosp.personnel = (int)pow(2, level - 1);
+ new->hosp.free_personnel = new->hosp.personnel;
+ new->hosp.num_waiting_patients = 0;
+ new->hosp.assess.forward = NULL;
+ new->hosp.assess.back = NULL;
+ new->hosp.waiting.forward = NULL;
+ new->hosp.waiting.back = NULL;
+ new->hosp.inside.forward = NULL;
+ new->hosp.inside.back = NULL;
+ new->returned.back = NULL;
+ new->returned.forward = NULL;
+
+ for (i = 0; i < 4; i++)
+ new->forward[i] =
+ alloc_tree(level - 1, (label * 4) + i + 1, new);
+
+ return new;
+ }
+}
+
+
+struct Results get_results(struct Village *village)
+{
+ int i;
+ struct List *list;
+ struct Patient *p;
+ struct Village *v;
+ struct Results r1;
+
+ r1.total_hosps = 0.0;
+ r1.total_patients = 0.0;
+ r1.total_time = 0.0;
+
+ if (village == NULL) return r1;
+
+ for (i = 0; i < 4; i++ ) {
+ struct Results res;
+
+ v = village->forward[i];
+ res = get_results(v);
+
+ r1.total_hosps += res.total_hosps;
+ r1.total_patients += res.total_patients;
+ r1.total_time += res.total_time;
+ }
+
+ list = village->returned.forward;
+ while (list != NULL) {
+ p = list->patient;
+ r1.total_hosps += (float)(p->hosps_visited);
+ r1.total_time += (float)(p->time);
+ r1.total_patients += 1.0;
+ list = list->forward;
+ }
+
+ return r1;
+}
+
+
+void check_patients_inside(struct Village *village, struct List *list)
+{
+ struct Patient *p;
+
+ while (list != NULL)
+ {
+
+ p = list->patient;
+ p->time_left--;
+
+ if (p->time_left == 0)
+ {
+ village->hosp.free_personnel++;
+ removeList(&(village->hosp.inside), p);
+ addList(&(village->returned), p);
+ }
+ list = list->forward;
+ }
+}
+
+
+struct List *check_patients_assess(struct Village *village, struct List *list)
+{
+ float rand;
+ struct Patient *p;
+ int label;
+
+ while (list != NULL)
+ {
+ p = list->patient;
+ p->time_left--;
+ label = village->label;
+
+ if (p->time_left == 0)
+ {
+ rand = my_rand(village->seed);
+ village->seed = (long)(rand * IM);
+ label = village->label;
+
+ if (rand > 0.1 || label == 0)
+ {
+ removeList(&(village->hosp.assess), p);
+ addList(&(village->hosp.inside), p);
+ p->time_left = 10;
+ p->time += p->time_left;
+ }
+ else
+ {
+ village->hosp.free_personnel++;
+ removeList(&(village->hosp.assess), p);
+ addList(&(village->hosp.up), p);
+ }
+ }
+
+ list = list->forward;
+ }
+ return &(village->hosp.up);
+}
+
+
+void check_patients_waiting(struct Village *village, struct List *list)
+{
+ int i;
+ struct Patient *p;
+
+ while (list != NULL)
+ {
+ i = village->hosp.free_personnel;
+ p = list->patient; /* This is a bad load */
+
+ if (i > 0)
+ {
+ village->hosp.free_personnel--;
+ p->time_left = 3;
+ p->time += p->time_left;
+ removeList(&(village->hosp.waiting), p);
+ addList(&(village->hosp.assess), p);
+ }
+ else
+ {
+ p->time++; /* so is this */
+ }
+ list = list->forward;
+ }
+}
+
+
+void put_in_hosp(struct Hosp *hosp, struct Patient *patient)
+{
+ patient->hosps_visited++;
+
+ if (hosp->free_personnel > 0)
+ {
+ hosp->free_personnel--;
+ addList(&(hosp->assess), patient);
+ patient->time_left = 3;
+ patient->time += patient->time_left;
+ }
+ else
+ {
+ addList(&(hosp->waiting), patient);
+ }
+}
+
+
+struct Patient *generate_patient(struct Village *village)
+{
+ struct Patient *patient = NULL;
+ float rand;
+
+ rand = my_rand(village->seed);
+ village->seed = (long)(rand * IM);
+
+ if (rand > 0.666)
+ {
+ patient = (struct Patient *)mymalloc(sizeof(struct Patient));
+ patient->hosps_visited = 0;
+ patient->time = 0;
+ patient->time_left = 0;
+ patient->home_village = village;
+ }
+
+ return patient;
+}
+
+int
+main(int argc, char *argv[])
+{
+ struct Results results;
+ struct Village *top;
+ long i;
+ float total_time,
+ total_patients,
+ total_hosps;
+
+ dealwithargs(argc, argv);
+
+ top = alloc_tree(max_level, 0, NULL);
+
+ chatting("\n\n Colombian Health Care Simulator\n\n");
+ chatting("Working...\n");
+
+ // sm: changed "%d" to "%ld" to silence gcc warning
+ fprintf(stderr, "This is max_time right before the loop: %ld\n", max_time);
+ for (i = 0; i < max_time; i++)
+ {
+ //printf("This is i with each iteration: %d\n", i);
+ if ((i % 10) == 0)
+ chatting("iteration %d\n", i);
+ sim(top);
+ }
+
+ results = get_results(top);
+ total_patients = results.total_patients;
+ total_time = results.total_time;
+ total_hosps = results.total_hosps;
+
+ chatting("Done.\n\n");
+ chatting("# of people treated: %f people\n",
+ total_patients);
+ chatting("Average length of stay: %f time units\n",
+ total_time / total_patients);
+ chatting("Average # of hospitals visited: %f hospitals\n\n",
+ total_hosps / total_patients);
+ return 0;
+}
+
+
+struct List *sim(struct Village *village)
+{
+ int i;
+ struct Patient *patient, *p;
+ struct List *l, *vl, *up;
+
+ if (village == NULL)
+ return NULL;
+
+ for (i = 0; i < 4; i++)
+ {
+ l = vl = sim(village->forward[i]);
+
+ if (l != NULL)
+ {
+ l = l->forward;
+ while (l != NULL)
+ {
+ p = l->patient;
+ put_in_hosp(&(village->hosp), p);
+ removeList(vl, p);
+ l = l->forward;
+ }
+ }
+ }
+
+
+ /* Uses lists inside, and return */
+ check_patients_inside(village, village->hosp.inside.forward);
+
+ /* Uses lists assess, inside, and up */
+ up = check_patients_assess(village, village->hosp.assess.forward);
+
+ /* Uses lists waiting, and assess */
+ check_patients_waiting(village, village->hosp.waiting.forward);
+
+ if ((patient = generate_patient(village)) != NULL)
+ {
+ put_in_hosp(&(village->hosp), patient);
+ }
+
+ return up;
+}
+
+
+
+
+
+
+
+
diff --git a/test/ccured_olden/health/health.h b/test/ccured_olden/health/health.h
new file mode 100644
index 00000000..4d3c4fd8
--- /dev/null
+++ b/test/ccured_olden/health/health.h
@@ -0,0 +1,76 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/****************************************************************
+ * health.h: header file for health.c *
+ *************************************************************** */
+
+
+#ifndef _HEALTH
+#define _HEALTH
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define IA 16807
+#define IM 2147483647
+#define AM (1.0 / IM)
+#define IQ 127773
+#define IR 2836
+#define MASK 123459876
+
+int max_level;
+long max_time,
+ seed;
+
+struct Results {
+ float total_patients;
+ float total_time;
+ float total_hosps; };
+
+struct Patient {
+ int hosps_visited;
+ int time;
+ int time_left;
+ struct Village *home_village; };
+
+struct List {
+ struct Patient *patient;
+ struct List *back;
+ struct List *forward; };
+
+struct Hosp {
+ int personnel;
+ int free_personnel;
+ int num_waiting_patients;
+ struct List waiting;
+ struct List assess;
+ struct List inside;
+ struct List up; };
+
+struct Village {
+ struct Village *forward[4],
+ *back;
+ struct List returned;
+ struct Hosp hosp;
+ int label;
+ long seed; };
+
+void dealwithargs(int argc, char *argv[]);
+float my_rand(long idum);
+struct Patient *generate_patient(struct Village *village);
+void put_in_hosp(struct Hosp *hosp, struct Patient *patient);
+void addList(struct List *list, struct Patient *patient);
+void removeList(struct List *list, struct Patient *patient);
+struct List *sim(struct Village *village);
+void check_patients_inside(struct Village *village, struct List *list);
+struct List *check_patients_assess(struct Village *village, struct List *list);
+void check_patients_waiting(struct Village *village, struct List *list);
+float get_num_people(struct Village *village);
+float get_total_time(struct Village *village);
+float get_total_hosps(struct Village *village);
+struct Results get_results(struct Village *village);
+
+#endif
+
+
+
diff --git a/test/ccured_olden/health/list.c b/test/ccured_olden/health/list.c
new file mode 100644
index 00000000..dcd268cc
--- /dev/null
+++ b/test/ccured_olden/health/list.c
@@ -0,0 +1,55 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/********************************************************************
+ * List.c: Handles lists. *
+ * To be used with health.c *
+ ******************************************************************* */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include "health.h"
+
+#ifdef SS_PLAIN
+#include "ssplain.h"
+#endif SS_PLAIN
+
+void addList(struct List *list, struct Patient *patient) {
+ struct List *b;
+
+ while (list != NULL)
+ {
+ b = list;
+ list = list->forward;
+ }
+
+ list = (struct List *)mymalloc(sizeof(struct List));
+ list->patient = patient;
+ list->forward = NULL;
+ list->back = b;
+ b->forward = list;
+}
+
+
+void removeList(struct List *list, struct Patient *patient)
+{
+ struct List *l1,*l2;
+ struct Patient *p;
+
+ p = list->patient;
+ while(p != patient)
+ {
+ list = list->forward;
+ p = list->patient;
+ }
+
+ l1 = list->back;
+ l2 = list->forward;
+ l1->forward = l2;
+ if (list->forward != NULL)
+ {
+ l1 = list->forward;
+ l2 = list->back;
+ l1->back = l2;
+ }
+}
+
diff --git a/test/ccured_olden/health/out.orig b/test/ccured_olden/health/out.orig
new file mode 100644
index 00000000..42fd5748
--- /dev/null
+++ b/test/ccured_olden/health/out.orig
@@ -0,0 +1,64 @@
+This is max_level : 5
+This is max_time : 500
+
+
+ Colombian Health Care Simulator
+
+Working...
+This is max_time right before the loop: 500
+iteration 0
+iteration 10
+iteration 20
+iteration 30
+iteration 40
+iteration 50
+iteration 60
+iteration 70
+iteration 80
+iteration 90
+iteration 100
+iteration 110
+iteration 120
+iteration 130
+iteration 140
+iteration 150
+iteration 160
+iteration 170
+iteration 180
+iteration 190
+iteration 200
+iteration 210
+iteration 220
+iteration 230
+iteration 240
+iteration 250
+iteration 260
+iteration 270
+iteration 280
+iteration 290
+iteration 300
+iteration 310
+iteration 320
+iteration 330
+iteration 340
+iteration 350
+iteration 360
+iteration 370
+iteration 380
+iteration 390
+iteration 400
+iteration 410
+iteration 420
+iteration 430
+iteration 440
+iteration 450
+iteration 460
+iteration 470
+iteration 480
+iteration 490
+Done.
+
+# of people treated: 17508.000000 people
+Average length of stay: 155.341615 time units
+Average # of hospitals visited: 1.074195 hospitals
+
diff --git a/test/ccured_olden/health/out.orig.msvc b/test/ccured_olden/health/out.orig.msvc
new file mode 100644
index 00000000..6de26a47
--- /dev/null
+++ b/test/ccured_olden/health/out.orig.msvc
@@ -0,0 +1,64 @@
+This is max_level : 5
+This is max_time : 500
+
+
+ Colombian Health Care Simulator
+
+Working...
+This is max_time right before the loop: 500
+iteration 0
+iteration 10
+iteration 20
+iteration 30
+iteration 40
+iteration 50
+iteration 60
+iteration 70
+iteration 80
+iteration 90
+iteration 100
+iteration 110
+iteration 120
+iteration 130
+iteration 140
+iteration 150
+iteration 160
+iteration 170
+iteration 180
+iteration 190
+iteration 200
+iteration 210
+iteration 220
+iteration 230
+iteration 240
+iteration 250
+iteration 260
+iteration 270
+iteration 280
+iteration 290
+iteration 300
+iteration 310
+iteration 320
+iteration 330
+iteration 340
+iteration 350
+iteration 360
+iteration 370
+iteration 380
+iteration 390
+iteration 400
+iteration 410
+iteration 420
+iteration 430
+iteration 440
+iteration 450
+iteration 460
+iteration 470
+iteration 480
+iteration 490
+Done.
+
+# of people treated: 17510.000000 people
+Average length of stay: 153.627927 time units
+Average # of hospitals visited: 1.068646 hospitals
+
diff --git a/test/ccured_olden/health/output b/test/ccured_olden/health/output
new file mode 100644
index 00000000..42fd5748
--- /dev/null
+++ b/test/ccured_olden/health/output
@@ -0,0 +1,64 @@
+This is max_level : 5
+This is max_time : 500
+
+
+ Colombian Health Care Simulator
+
+Working...
+This is max_time right before the loop: 500
+iteration 0
+iteration 10
+iteration 20
+iteration 30
+iteration 40
+iteration 50
+iteration 60
+iteration 70
+iteration 80
+iteration 90
+iteration 100
+iteration 110
+iteration 120
+iteration 130
+iteration 140
+iteration 150
+iteration 160
+iteration 170
+iteration 180
+iteration 190
+iteration 200
+iteration 210
+iteration 220
+iteration 230
+iteration 240
+iteration 250
+iteration 260
+iteration 270
+iteration 280
+iteration 290
+iteration 300
+iteration 310
+iteration 320
+iteration 330
+iteration 340
+iteration 350
+iteration 360
+iteration 370
+iteration 380
+iteration 390
+iteration 400
+iteration 410
+iteration 420
+iteration 430
+iteration 440
+iteration 450
+iteration 460
+iteration 470
+iteration 480
+iteration 490
+Done.
+
+# of people treated: 17508.000000 people
+Average length of stay: 155.341615 time units
+Average # of hospitals visited: 1.074195 hospitals
+
diff --git a/test/ccured_olden/health/poisson.c b/test/ccured_olden/health/poisson.c
new file mode 100644
index 00000000..c3ff696f
--- /dev/null
+++ b/test/ccured_olden/health/poisson.c
@@ -0,0 +1,35 @@
+/* For copyright information, see olden_v1.0/COPYRIGHT */
+
+/**********************************************************
+ * poisson.c: handles math routines for health.c *
+ **********************************************************/
+
+#include <stdio.h>
+#include <math.h>
+#include "health.h"
+
+
+float my_rand(long idum)
+{
+ long k;
+ float answer;
+
+ idum ^= MASK;
+ k = idum / IQ;
+ idum = IA * (idum - k * IQ) - IR * k;
+ idum ^= MASK;
+ if (idum < 0)
+ idum += IM;
+ answer = AM * idum;
+#ifdef GET_OUT
+ fprintf(stderr, "my_rand: idum = %d, AM = %e, answer = %4.3f\n",
+ idum, AM, answer);
+#endif GET_OUT
+ return answer;
+}
+
+
+
+
+
+
diff --git a/test/ccured_olden/health/ssplain.c b/test/ccured_olden/health/ssplain.c
new file mode 100644
index 00000000..04a150fb
--- /dev/null
+++ b/test/ccured_olden/health/ssplain.c
@@ -0,0 +1,70 @@
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <limits.h>
+#include <stddef.h>
+#include "ssplain.h"
+
+void chatting(char *s, ...)
+{
+ //printf("Here is a character: %c", *s);
+ va_list ap;
+ va_start(ap,s);
+ vfprintf(stderr, s, ap);
+ va_end(ap);
+}
+
+
+
+#ifdef SS_RAND
+double drand48()
+{
+ double d;
+ d = (double) random() / LONG_MAX;
+ return d;
+}
+
+
+long lrand48()
+{
+ long l = random();
+ return l;
+}
+
+void srand48(long seed)
+{
+ srand(seed);
+}
+#endif SS_RAND
+
+#ifndef BEFOREBOX
+static unsigned long bytes_allocated = 0;
+static unsigned long allocations = 0;
+
+void*
+ssplain_malloc(int size)
+{
+ allocations++;
+ bytes_allocated+=size;
+ return malloc(size);
+}
+
+void*
+ssplain_calloc(int nelems, int size)
+{
+ void *p;
+ allocations++;
+ bytes_allocated+= nelems * size;
+ p = calloc(nelems, size);
+ if(!p) { printf("Cannot allocate\n"); exit(3); }
+ return p;
+}
+
+void
+ssplain_alloc_stats()
+{
+ chatting("Allocation stats: %d bytes allocated in %d allocations\n",
+ bytes_allocated, allocations);
+}
+#endif
diff --git a/test/ccured_olden/health/ssplain.h b/test/ccured_olden/health/ssplain.h
new file mode 100644
index 00000000..157c1cbe
--- /dev/null
+++ b/test/ccured_olden/health/ssplain.h
@@ -0,0 +1,130 @@
+#ifndef SS_PLAIN_H
+#define SS_PLAIN_H
+
+void * ssplain_malloc(int size);
+void * ssplain_calloc(int nelems, int size);
+void ssplain_alloc_stats();
+
+/* Convert MP shutdown to exit */
+#define __ShutDown(ID) { ssplain_alloc_stats(); exit(ID); }
+
+/* All these CM-5 things are nops */
+#define CMMD_node_timer_clear(ID)
+#define CMMD_node_timer_start(ID)
+#define CMMD_node_timer_stop(ID)
+#define CMMD_node_timer_elapsed(ID) ((double)0)
+
+#define CMMD_self_address() 0
+
+#define ClearAllStats()
+
+/* define away the CM-5 allocator */
+#include <stdlib.h>
+
+#ifndef ALLOC
+#define ALLOC(NUM,ESIZE) ssplain_calloc (NUM+1,ESIZE)
+#endif ALLOC
+
+#ifndef mymalloc
+#define mymalloc malloc
+#endif mymalloc
+
+/* Get all of these multiprocessing things out of here. */
+/* My id will stay that way */
+#define IDMASK 0xffffffff
+
+/* Nothing is getting tested */
+#ifndef RETEST
+#define RETEST()
+#endif RETEST
+
+#ifndef NOTEST
+#define NOTEST()
+#endif NOTEST
+
+/* Everything is local */
+#ifndef local
+#define local
+#endif local
+
+#ifndef LOCAL
+#define LOCAL(VAL) (VAL)
+#endif LOCAL
+
+#ifndef ISLOCPTR
+#define ISLOCPTR(VAL) (1)
+#endif ISLOCPTR
+
+#ifndef MLOCAL
+#define MLOCAL(VAL)
+#endif MLOCAL
+
+/* An atomic increment is a normal increment */
+#ifndef ATOMICINC
+#define ATOMICINC(PVAL) (*(PVAL) = *(PVAL) + 1)
+#endif ATOMICINC
+
+/* Nothing is migrating anywhere */
+#ifndef MIGRATE
+#define MIGRATE(ID)
+#endif MIGRATE
+
+#ifndef MIGRPH
+#define MIGRPH()
+#endif MIGRPH
+
+#ifndef UNPHASE
+#define UNPHASE()
+#endif UNPHASE
+
+#ifndef PID
+#define PID(VAL) (0)
+#endif PID
+
+/* All these functions */
+#ifdef CCURED
+ #pragma ccuredvararg("chatting", printf(1))
+#endif
+void chatting(char *s, ...);
+
+/* just define these guys, they are not going to change */
+#define __NumNodes 1
+#define __MyNodeId 0
+#define __NDim 0
+
+typedef struct ss_future_cell_int {
+ int value;
+} future_cell_int;
+
+/* Where are these things for real? */
+#ifdef SS_RAND
+long lrand48();
+double drand48();
+void srand48(long seed);
+#endif SS_RAND
+
+#define MOD(V,M) ((V) & ((M) - 1))
+#define INC_MOD(V,M) (V) = MOD((V) + 1, (M))
+
+/* Prefetch instructions */
+
+/* Use these for 1 lookahead prefetching */
+
+#ifdef OVERHEAD_ONLY
+#define ASSEMBLE_PREFETCH(ARG)
+#define ASSEMBLE_PREFETCH_HEAD(ARG)
+#else !OVERHEAD_ONLY
+
+#define ASSEMBLE_PREFETCH(ARG) \
+ asm ("lw $0, %0" : /* no outputs */ : "g" (ARG))
+
+/* Use these for infinite lookahead prefetching */
+#define ASSEMBLE_PREFETCH_HEAD(ARG) \
+ asm ("lh $0, %0" : /* no outputs */ : "g" (ARG))
+
+#endif OVERHEAD_ONLY
+
+#endif SS_PLAIN_H
+
+
+
diff --git a/test/ccured_olden/health/testit b/test/ccured_olden/health/testit
new file mode 100755
index 00000000..6b943eac
--- /dev/null
+++ b/test/ccured_olden/health/testit
@@ -0,0 +1,25 @@
+#!/bin/sh
+# test a health binary
+
+if [ "$1" = "" ]; then
+ echo "usage: $0 ./health.exe"
+ exit
+fi
+
+# all of health's output is to stderr
+echo "running: $1 5 500 1 1 2>output"
+if ! $1 5 500 1 1 2>output; then
+ echo "$1 failed directly"
+ exit 2
+fi
+
+if ! diff out.orig output >out.diff 2>&1 ; then
+ if ! diff out.orig.msvc output >/dev/null ; then
+ echo "$1 got the wrong answer. See out.diff"
+ exit 4
+ fi
+fi
+
+echo "$1 seems to work"
+rm -f out.diff
+ \ No newline at end of file