diff options
| author | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-17 14:43:46 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-17 14:43:46 -0400 |
| commit | a3886552003d031acb9039e920b7c9ddce946ad6 (patch) | |
| tree | c3b6a400a9ba31e744e6218365d63bdfbbc45a83 /dis/Pointer | |
| parent | 917499f6257ac51c05e8302af877d56a22f28cb5 (diff) | |
DIS fixes used for (rejected) RTSS'20 submission
- All: Output times to stderr and nothing to stdout
- Field, Update, Pointer: change definition of a job to match other
stressmark execution times more closely
- Matrix: move all allocations into main()
- Update: Use volatile to prevent computations from being optimized out
- Transitive: Use volatile to prevent computations from being optimized out
- Neighborhood: Use working version of drawLineSegment from original DIS
sample code
Diffstat (limited to 'dis/Pointer')
| -rw-r--r-- | dis/Pointer/pointer.c | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/dis/Pointer/pointer.c b/dis/Pointer/pointer.c index 5671697..3fc7248 100644 --- a/dis/Pointer/pointer.c +++ b/dis/Pointer/pointer.c | |||
| @@ -38,19 +38,19 @@ | |||
| 38 | int main(int argc, char** argv){ | 38 | int main(int argc, char** argv){ |
| 39 | 39 | ||
| 40 | unsigned int *field; | 40 | unsigned int *field; |
| 41 | unsigned int f; | 41 | unsigned long f; |
| 42 | unsigned short int w; | 42 | unsigned short int w; |
| 43 | unsigned int maxhops; | 43 | unsigned long maxhops; |
| 44 | int seed; | 44 | long seed; |
| 45 | unsigned int n; | 45 | unsigned int n; |
| 46 | 46 | ||
| 47 | clock_t startTime; | 47 | clock_t startTime, endTime; |
| 48 | 48 | ||
| 49 | struct threadS{ | 49 | struct threadS{ |
| 50 | unsigned int initial; | 50 | unsigned long initial; |
| 51 | unsigned int minStop; | 51 | unsigned long minStop; |
| 52 | unsigned int maxStop; | 52 | unsigned long maxStop; |
| 53 | unsigned int hops; | 53 | unsigned long hops; |
| 54 | }*thread; | 54 | }*thread; |
| 55 | 55 | ||
| 56 | unsigned int l; | 56 | unsigned int l; |
| @@ -72,7 +72,7 @@ int main(int argc, char** argv){ | |||
| 72 | return (-1); | 72 | return (-1); |
| 73 | 73 | ||
| 74 | for (l=0; l<n; l++){ | 74 | for (l=0; l<n; l++){ |
| 75 | assert(fscanf(stdin, "%lu %lu %lu", | 75 | assert(fscanf(stdin, "%lu %lu %lu", |
| 76 | &(thread[l].initial), &(thread[l].minStop), &(thread[l].maxStop)) == 3); | 76 | &(thread[l].initial), &(thread[l].minStop), &(thread[l].maxStop)) == 3); |
| 77 | assert ((thread[l].initial >= 0) && (thread[l].initial < f)); | 77 | assert ((thread[l].initial >= 0) && (thread[l].initial < f)); |
| 78 | assert ((thread[l].minStop >= 0) && (thread[l].minStop < f)); | 78 | assert ((thread[l].minStop >= 0) && (thread[l].minStop < f)); |
| @@ -89,9 +89,9 @@ int main(int argc, char** argv){ | |||
| 89 | startTime = time(NULL); | 89 | startTime = time(NULL); |
| 90 | clock(); | 90 | clock(); |
| 91 | 91 | ||
| 92 | START_LOOP | ||
| 92 | for (l=0; l<n; l++) | 93 | for (l=0; l<n; l++) |
| 93 | { | 94 | { |
| 94 | START_LOOP | ||
| 95 | unsigned int index; | 95 | unsigned int index; |
| 96 | unsigned int minStop, maxStop; | 96 | unsigned int minStop, maxStop; |
| 97 | unsigned int hops; | 97 | unsigned int hops; |
| @@ -142,16 +142,18 @@ for (l=0; l<n; l++) | |||
| 142 | hops++; | 142 | hops++; |
| 143 | }/* end loop ll */ | 143 | }/* end loop ll */ |
| 144 | thread[l].hops = hops; | 144 | thread[l].hops = hops; |
| 145 | STOP_LOOP | ||
| 146 | } /* end while */ | 145 | } /* end while */ |
| 146 | STOP_LOOP | ||
| 147 | 147 | ||
| 148 | startTime = time(NULL) - startTime; | 148 | endTime = time(NULL); |
| 149 | 149 | ||
| 150 | for (l=0; l<n; l++){ | 150 | volatile int _stop_optimizer = thread[l].hops + l; |
| 151 | /*for (l=0; l<n; l++){ | ||
| 151 | fprintf(stdout, "%lu hops on thread %d\n", thread[l].hops, l); | 152 | fprintf(stdout, "%lu hops on thread %d\n", thread[l].hops, l); |
| 152 | } | 153 | }*/ |
| 153 | 154 | ||
| 154 | fprintf(stderr, "total time = %u seconds.\n", (unsigned int)startTime); | 155 | fprintf(stderr, "time for pointer stressmark = %f seconds.\n", |
| 156 | difftime(endTime, startTime)); | ||
| 155 | free (field); | 157 | free (field); |
| 156 | free (thread); | 158 | free (thread); |
| 157 | WRITE_TO_FILE | 159 | WRITE_TO_FILE |
