diff options
| -rw-r--r-- | dis/Field/DISstressmarkRNG.h | 1 | ||||
| -rw-r--r-- | dis/Field/field.c | 162 | ||||
| -rwxr-xr-x | dis/Makefile | 2 | ||||
| -rwxr-xr-x | dis/Matrix/ver2/DISstressmarkRNG.h | 1 | ||||
| -rwxr-xr-x | dis/Matrix/ver2/matrix.c | 468 | ||||
| -rw-r--r-- | dis/Neighborhood/DISstressmarkRNG.h | 1 | ||||
| -rw-r--r-- | dis/Neighborhood/neighborhood.c | 77 | ||||
| -rw-r--r-- | dis/Neighborhood/utili.h | 435 | ||||
| -rw-r--r-- | dis/Pointer/DISstressmarkRNG.h | 1 | ||||
| -rw-r--r-- | dis/Pointer/pointer.c | 225 | ||||
| -rw-r--r-- | dis/Transitive/DISstressmarkRNG.h | 1 | ||||
| -rw-r--r-- | dis/Transitive/transitive.c | 103 | ||||
| -rw-r--r-- | dis/Update/DISstressmarkRNG.h | 1 | ||||
| -rw-r--r-- | dis/Update/update.c | 98 |
14 files changed, 747 insertions, 829 deletions
diff --git a/dis/Field/DISstressmarkRNG.h b/dis/Field/DISstressmarkRNG.h index 4aa2620..6243606 100644 --- a/dis/Field/DISstressmarkRNG.h +++ b/dis/Field/DISstressmarkRNG.h | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | #include <assert.h> | ||
| 1 | #include <math.h> | 2 | #include <math.h> |
| 2 | 3 | ||
| 3 | #define IA 16807 | 4 | #define IA 16807 |
diff --git a/dis/Field/field.c b/dis/Field/field.c index f83a403..248f779 100644 --- a/dis/Field/field.c +++ b/dis/Field/field.c | |||
| @@ -1,28 +1,27 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Sample code for the DIS Field Stressmark | 2 | * Sample code for the DIS Field Stressmark |
| 3 | * | 3 | * |
| 4 | * This source code is the completely correct source code based on | 4 | * This source code is the completely correct source code based on |
| 5 | * the example codes provided by Atlantic Aerospace Division, Titan | 5 | * the example codes provided by Atlantic Aerospace Division, Titan |
| 6 | * Systems Corporation, 2000. | 6 | * Systems Corporation, 2000. |
| 7 | * | 7 | * |
| 8 | * If you just compile and generate the executables from this source | 8 | * If you just compile and generate the executables from this source |
| 9 | * code, this code would be enough. However, if you wish to get a complete | 9 | * code, this code would be enough. However, if you wish to get a complete |
| 10 | * understanding of this stressmark, it is strongly suggested that you | 10 | * understanding of this stressmark, it is strongly suggested that you |
| 11 | * read the Benchmark Analysis and Specifications Document Version 1.0 | 11 | * read the Benchmark Analysis and Specifications Document Version 1.0 |
| 12 | * before going on since the detailed comments are given in this documents. | 12 | * before going on since the detailed comments are given in this documents. |
| 13 | * the comments are not repeated here. | 13 | * the comments are not repeated here. |
| 14 | */ | 14 | */ |
| 15 | 15 | ||
| 16 | #include <stdio.h> | ||
| 17 | #include <time.h> | ||
| 18 | #include <assert.h> | ||
| 19 | #include <stdlib.h> | ||
| 20 | #include "DISstressmarkRNG.h" | 16 | #include "DISstressmarkRNG.h" |
| 21 | #include "extra.h" | 17 | #include "extra.h" |
| 22 | 18 | #include <assert.h> | |
| 19 | #include <stdio.h> | ||
| 20 | #include <stdlib.h> | ||
| 21 | #include <time.h> | ||
| 23 | 22 | ||
| 24 | #define MIN_FIELD_SIZE 16 | 23 | #define MIN_FIELD_SIZE 16 |
| 25 | #define MAX_FIELD_SIZE (16777216*4) // This has been quadrupled from original | 24 | #define MAX_FIELD_SIZE (16777216 * 4) // This has been quadrupled from original |
| 26 | #define MIN_SEED -2147483647 | 25 | #define MIN_SEED -2147483647 |
| 27 | #define MAX_SEED -1 | 26 | #define MAX_SEED -1 |
| 28 | #define MIN_MOD_OFFSET 0 | 27 | #define MIN_MOD_OFFSET 0 |
| @@ -39,7 +38,7 @@ | |||
| 39 | * main() | 38 | * main() |
| 40 | */ | 39 | */ |
| 41 | 40 | ||
| 42 | int main(int argc, char** argv){ | 41 | int main(int argc, char **argv) { |
| 43 | SET_UP | 42 | SET_UP |
| 44 | unsigned char *field; | 43 | unsigned char *field; |
| 45 | unsigned int f; | 44 | unsigned int f; |
| @@ -48,17 +47,17 @@ int main(int argc, char** argv){ | |||
| 48 | unsigned int n; | 47 | unsigned int n; |
| 49 | 48 | ||
| 50 | time_t startTime, endTime; | 49 | time_t startTime, endTime; |
| 51 | 50 | ||
| 52 | struct tokenS{ | 51 | struct tokenS { |
| 53 | unsigned char delimiter[MAX_TOKEN_LENGTH]; | 52 | unsigned char delimiter[MAX_TOKEN_LENGTH]; |
| 54 | unsigned char length; | 53 | unsigned char length; |
| 55 | struct statisticS{ | 54 | struct statisticS { |
| 56 | unsigned int count; | 55 | unsigned int count; |
| 57 | unsigned char min; | 56 | unsigned char min; |
| 58 | unsigned char sum; | 57 | unsigned char sum; |
| 59 | }stat[MAX_SUBFIELDS]; | 58 | } stat[MAX_SUBFIELDS]; |
| 60 | unsigned char subfields; | 59 | unsigned char subfields; |
| 61 | }token[MAX_TOKENS]; | 60 | } token[MAX_TOKENS]; |
| 62 | 61 | ||
| 63 | unsigned int l; | 62 | unsigned int l; |
| 64 | 63 | ||
| @@ -68,91 +67,92 @@ int main(int argc, char** argv){ | |||
| 68 | assert((seed >= MIN_SEED) && (seed <= MAX_SEED)); | 67 | assert((seed >= MIN_SEED) && (seed <= MAX_SEED)); |
| 69 | assert((mod_offset >= MIN_MOD_OFFSET) && (mod_offset <= MAX_MOD_OFFSET)); | 68 | assert((mod_offset >= MIN_MOD_OFFSET) && (mod_offset <= MAX_MOD_OFFSET)); |
| 70 | assert((n >= MIN_TOKENS) && (n <= MAX_TOKENS)); | 69 | assert((n >= MIN_TOKENS) && (n <= MAX_TOKENS)); |
| 71 | for (l=0; l<n; l++){ | 70 | for (l = 0; l < n; l++) { |
| 72 | int x; | 71 | int x; |
| 73 | int index; | 72 | int index; |
| 74 | index = 0; | 73 | index = 0; |
| 75 | assert(fscanf(stdin,"%x", &x) == 1); | 74 | assert(fscanf(stdin, "%x", &x) == 1); |
| 76 | while(x!=0){ | 75 | while (x != 0) { |
| 77 | assert((x >= MIN_TOKEN_VALUE) && (x <= MAX_TOKEN_VALUE)); | 76 | assert((x >= MIN_TOKEN_VALUE) && (x <= MAX_TOKEN_VALUE)); |
| 78 | token[l].delimiter[index] = (unsigned char )x; | 77 | token[l].delimiter[index] = (unsigned char)x; |
| 79 | index++; | 78 | index++; |
| 80 | assert(fscanf(stdin,"%x", &x) == 1); | 79 | assert(fscanf(stdin, "%x", &x) == 1); |
| 81 | } | ||
| 82 | assert((index >= MIN_TOKEN_LENGTH) && (index <= MAX_TOKEN_LENGTH)); | ||
| 83 | token[l].length = index; | ||
| 84 | } | 80 | } |
| 81 | assert((index >= MIN_TOKEN_LENGTH) && (index <= MAX_TOKEN_LENGTH)); | ||
| 82 | token[l].length = index; | ||
| 83 | } | ||
| 85 | 84 | ||
| 86 | if ((field = (unsigned char*)malloc(f*sizeof(unsigned char))) == NULL) | 85 | if ((field = (unsigned char *)malloc(f * sizeof(unsigned char))) == NULL) |
| 87 | return (-1); | 86 | return (-1); |
| 88 | 87 | ||
| 89 | randInit(seed); | 88 | randInit(seed); |
| 90 | for (l =0; l<f; l++){ | 89 | for (l = 0; l < f; l++) { |
| 91 | field[l] = randInt(MIN_TOKEN_VALUE, MAX_TOKEN_VALUE); | 90 | field[l] = randInt(MIN_TOKEN_VALUE, MAX_TOKEN_VALUE); |
| 92 | } | 91 | } |
| 93 | 92 | ||
| 94 | startTime = time(NULL); | 93 | startTime = time(NULL); |
| 95 | START_LOOP | 94 | START_LOOP |
| 96 | 95 | ||
| 97 | for (l =0; l<n; l++){ | 96 | for (l = 0; l < n; l++) { |
| 98 | unsigned int index; | 97 | unsigned int index; |
| 99 | 98 | ||
| 100 | token[l].subfields = 0; | 99 | token[l].subfields = 0; |
| 101 | token[l].stat[0].count = 0; | 100 | token[l].stat[0].count = 0; |
| 102 | token[l].stat[0].sum = 0; | 101 | token[l].stat[0].sum = 0; |
| 103 | token[l].stat[0].min = MAX_TOKEN_VALUE; | 102 | token[l].stat[0].min = MAX_TOKEN_VALUE; |
| 104 | 103 | ||
| 105 | index = 0; | 104 | index = 0; |
| 106 | while ((index < f) && (token[l].subfields < MAX_SUBFIELDS)){ | 105 | while ((index < f) && (token[l].subfields < MAX_SUBFIELDS)) { |
| 107 | unsigned char offset; | 106 | unsigned char offset; |
| 108 | offset = 0; | 107 | offset = 0; |
| 109 | while ((field[index+offset] == token[l].delimiter[offset]) && | 108 | while ((field[index + offset] == token[l].delimiter[offset]) && |
| 110 | (offset < token[l].length)){ | 109 | (offset < token[l].length)) { |
| 111 | offset++; | 110 | offset++; |
| 112 | } | 111 | } |
| 113 | 112 | ||
| 114 | if (offset == token[l].length){ | 113 | if (offset == token[l].length) { |
| 115 | for (offset=0; offset<token[l].length; offset++){ | 114 | for (offset = 0; offset < token[l].length; offset++) { |
| 116 | field[index+offset] = (field[index+offset] + | 115 | field[index + offset] = (field[index + offset] + |
| 117 | field[(index+offset+mod_offset) % f]) | 116 | field[(index + offset + mod_offset) % f]) % |
| 118 | %(MAX_TOKEN_VALUE+1); | 117 | (MAX_TOKEN_VALUE + 1); |
| 119 | } | 118 | } |
| 120 | index += token[l].length-1; | 119 | index += token[l].length - 1; |
| 121 | token[l].subfields++; | 120 | token[l].subfields++; |
| 122 | token[l].stat[token[l].subfields].count = 0; | 121 | token[l].stat[token[l].subfields].count = 0; |
| 123 | token[l].stat[token[l].subfields].sum = 0; | 122 | token[l].stat[token[l].subfields].sum = 0; |
| 124 | token[l].stat[token[l].subfields].min = MAX_TOKEN_VALUE; | 123 | token[l].stat[token[l].subfields].min = MAX_TOKEN_VALUE; |
| 125 | } | 124 | } |
| 126 | 125 | ||
| 127 | else{ | 126 | else { |
| 128 | token[l].stat[token[l].subfields].count++; | 127 | token[l].stat[token[l].subfields].count++; |
| 129 | token[l].stat[token[l].subfields].sum += field[index]; | ||
