From 7e6ceb16b53fdbdb2a27cf3ade15d32177ff811f Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Sat, 19 Oct 2019 10:50:11 -0400 Subject: Add DIS benchmarks --- dis/original/Update/update.c | 133 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 dis/original/Update/update.c (limited to 'dis/original/Update/update.c') diff --git a/dis/original/Update/update.c b/dis/original/Update/update.c new file mode 100644 index 0000000..51e1530 --- /dev/null +++ b/dis/original/Update/update.c @@ -0,0 +1,133 @@ +/* + * Sample code for the DIS Update Stressmark + * + * This source code is the completely correct source code based on + * the example codes provided by Atlantic Aerospace Division, Titan + * Systems Corporation, 2000. + * + * If you just compile and generate the executables from this source + * code, this code would be enough. However, if you wish to get a complete + * understanding of this stressmark, it is strongly suggested that you + * read the Benchmark Analysis and Specifications Document Version 1.0 + * before going on since the detailed comments are given in this documents. + * the comments are not repeated here. + */ + +#include +#include +#include +#include +#include "DISstressmarkRNG.h" + +#define MIN_FIELD_SIZE 16 + +#define MAX_FIELD_SIZE 16777216 + +#define MIN_WINDOW_SIZE 1 + +#define MAX_WINDOW_SIZE 15 + +#define MIN_HOP_LIMIT 1 + +#define MAX_HOP_LIMIT 4294967295U + +#define MIN_SEED -2147483647 + +#define MAX_SEED -1 + +/* + *main() + */ + +int main(){ + + unsigned int *field; + unsigned int f; + unsigned int index; + unsigned short int w; + unsigned int maxhops; + int seed; + time_t startTime; + unsigned int initial; + unsigned int minStop; + unsigned int maxStop; + unsigned int hops; + unsigned int l; + + fscanf(stdin, "%u %u %u %d %u %u %u", + &f, &l, &maxhops, &seed, &initial, &minStop, &maxStop); + + assert((f >= MIN_FIELD_SIZE) && (f <= MAX_FIELD_SIZE)); + w = (unsigned int )l; + assert((w >= MIN_WINDOW_SIZE) && (w <= MAX_WINDOW_SIZE)); + assert(w%2 == 1); + assert(f > w); + assert((maxhops >= MIN_HOP_LIMIT) && (maxhops <= MAX_HOP_LIMIT)); + assert((seed >= MIN_SEED) && (seed <= MAX_SEED)); + assert((initial >= 0) && (initial < f)); + assert((minStop >= 0) && (minStop < f)); + assert((maxStop >= 0) && (maxStop < f)); + + if ((field = (unsigned int *)malloc(f*sizeof(int))) == NULL) + return (-1); + + randInit(seed); + for (l=0; l= minStop) && + (index < maxStop)))){ + int sum; + + unsigned int ll, lll; + unsigned int max, min; + unsigned int partition; + unsigned int high; + max = MAX_FIELD_SIZE; + min = 0; + high = 0; + sum = 0; + + for (ll=0; ll max) high++; + else if (x >min){ /* start else* */ + partition = x; + balance = 0; + for (lll=ll+1; lll partition) balance++; + } + if (balance+high == w/2) break; + else if (balance+high>w/2){ + min = partition; + }/* end if */ + else{ + max = partition; + high++; + } /* end else */ + } + if (min == max) break; + }/* end else* */ + field[index] = sum % (f-w); + index = (partition+hops)%(f-w); + hops++; + }/* end for loop */ + + startTime = time(NULL) - startTime; + + fprintf(stdout, "%u hops\n", hops); + fprintf(stderr, "total time = %u seconds.\n", (unsigned int)startTime); + free(field); + return(1); +} -- cgit v1.2.2