Rev 2050 | Rev 2071 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2050 | Rev 2051 | ||
---|---|---|---|
Line 101... | Line 101... | ||
101 | 101 | ||
102 | 102 | ||
103 | static atomic_t threads_ok; |
103 | static atomic_t threads_ok; |
104 | static atomic_t threads_fault; |
104 | static atomic_t threads_fault; |
105 | static waitq_t can_start; |
105 | static waitq_t can_start; |
- | 106 | static bool sh_quiet; |
|
106 | 107 | ||
107 | static void e(void *data) |
108 | static void e(void *data) |
108 | { |
109 | { |
109 | int i; |
110 | int i; |
110 | double e,d,le,f; |
111 | double e, d, le, f; |
111 | 112 | ||
112 | thread_detach(THREAD); |
113 | thread_detach(THREAD); |
113 | 114 | ||
114 | waitq_sleep(&can_start); |
115 | waitq_sleep(&can_start); |
115 | 116 | ||
Line 122... | Line 123... | ||
122 | le = e; |
123 | le = e; |
123 | e = e + 1 / d; |
124 | e = e + 1 / d; |
124 | } |
125 | } |
125 | 126 | ||
126 | if ((int) (100000000 * e) != E_10e8) { |
127 | if ((int) (100000000 * e) != E_10e8) { |
- | 128 | if (!sh_quiet) |
|
127 | printf("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8); |
129 | printf("tid%d: e*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * e), (unative_t) E_10e8); |
128 | atomic_inc(&threads_fault); |
130 | atomic_inc(&threads_fault); |
129 | break; |
131 | break; |
130 | } |
132 | } |
131 | } |
133 | } |
132 | atomic_inc(&threads_ok); |
134 | atomic_inc(&threads_ok); |
Line 156... | Line 158... | ||
156 | pi = 2 * n * ad; |
158 | pi = 2 * n * ad; |
157 | } |
159 | } |
158 | 160 | ||
159 | #ifdef KERN_ia64_ARCH_H_ |
161 | #ifdef KERN_ia64_ARCH_H_ |
160 | if ((int) (1000000 * pi) != PI_10e8) { |
162 | if ((int) (1000000 * pi) != PI_10e8) { |
- | 163 | if (!sh_quiet) |
|
161 | printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100)); |
164 | printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (1000000 * pi), (unative_t) (PI_10e8 / 100)); |
162 | atomic_inc(&threads_fault); |
165 | atomic_inc(&threads_fault); |
163 | break; |
166 | break; |
164 | } |
167 | } |
165 | #else |
168 | #else |
166 | if ((int) (100000000 * pi) != PI_10e8) { |
169 | if ((int) (100000000 * pi) != PI_10e8) { |
- | 170 | if (!sh_quiet) |
|
167 | printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8); |
171 | printf("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (100000000 * pi), (unative_t) PI_10e8); |
168 | atomic_inc(&threads_fault); |
172 | atomic_inc(&threads_fault); |
169 | break; |
173 | break; |
170 | } |
174 | } |
171 | #endif |
175 | #endif |
172 | } |
176 | } |
Line 174... | Line 178... | ||
174 | } |
178 | } |
175 | 179 | ||
176 | char * test_fpu1(bool quiet) |
180 | char * test_fpu1(bool quiet) |
177 | { |
181 | { |
178 | unsigned int i, total = 0; |
182 | unsigned int i, total = 0; |
- | 183 | sh_quiet = quiet; |
|
179 | 184 | ||
180 | waitq_initialize(&can_start); |
185 | waitq_initialize(&can_start); |
181 | atomic_set(&threads_ok, 0); |
186 | atomic_set(&threads_ok, 0); |
182 | atomic_set(&threads_fault, 0); |
187 | atomic_set(&threads_fault, 0); |
- | 188 | ||
- | 189 | if (!quiet) |
|
183 | printf("Creating %d threads... ", 2 * THREADS); |
190 | printf("Creating %d threads... ", 2 * THREADS); |
184 | 191 | ||
185 | for (i = 0; i < THREADS; i++) { |
192 | for (i = 0; i < THREADS; i++) { |
186 | thread_t *t; |
193 | thread_t *t; |
187 | 194 | ||
188 | if (!(t = thread_create(e, NULL, TASK, 0, "e", false))) { |
195 | if (!(t = thread_create(e, NULL, TASK, 0, "e", false))) { |
- | 196 | if (!quiet) |
|
189 | printf("could not create thread %d\n", 2 * i); |
197 | printf("could not create thread %d\n", 2 * i); |
190 | break; |
198 | break; |
191 | } |
199 | } |
192 | thread_ready(t); |
200 | thread_ready(t); |
193 | total++; |
201 | total++; |
194 | 202 | ||
195 | if (!(t = thread_create(pi, NULL, TASK, 0, "pi", false))) { |
203 | if (!(t = thread_create(pi, NULL, TASK, 0, "pi", false))) { |
- | 204 | if (!quiet) |
|
196 | printf("could not create thread %d\n", 2 * i + 1); |
205 | printf("could not create thread %d\n", 2 * i + 1); |
197 | break; |
206 | break; |
198 | } |
207 | } |
199 | thread_ready(t); |
208 | thread_ready(t); |
200 | total++; |
209 | total++; |
201 | } |
210 | } |
- | 211 | ||
- | 212 | if (!quiet) |
|
202 | printf("ok\n"); |
213 | printf("ok\n"); |
203 | 214 | ||
204 | thread_sleep(1); |
215 | thread_sleep(1); |
205 | waitq_wakeup(&can_start, WAKEUP_ALL); |
216 | waitq_wakeup(&can_start, WAKEUP_ALL); |
206 | 217 | ||
207 | while (atomic_get(&threads_ok) != total) { |
218 | while (atomic_get(&threads_ok) != total) { |
- | 219 | if (!quiet) |
|
208 | printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
220 | printf("Threads left: %d\n", total - atomic_get(&threads_ok)); |
209 | thread_sleep(1); |
221 | thread_sleep(1); |
210 | } |
222 | } |
211 | 223 | ||
212 | if (atomic_get(&threads_fault) == 0) |
224 | if (atomic_get(&threads_fault) == 0) |
213 | return NULL; |
225 | return NULL; |