Rev 1787 | Rev 2027 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 1787 | Rev 2021 | ||
|---|---|---|---|
| Line 35... | Line 35... | ||
| 35 | #include <proc/thread.h> |
35 | #include <proc/thread.h> |
| 36 | #include <time/delay.h> |
36 | #include <time/delay.h> |
| 37 | 37 | ||
| 38 | #include <arch.h> |
38 | #include <arch.h> |
| 39 | 39 | ||
| - | 40 | #ifdef CONFIG_BENCH |
|
| - | 41 | #include <arch/cycle.h> |
|
| - | 42 | #endif |
|
| - | 43 | ||
| - | 44 | #if (defined(ia32) || defined(amd64) || defined(ia32xen)) |
|
| - | 45 | ||
| 40 | #define THREADS 50 |
46 | #define THREADS 50 |
| 41 | #define DELAY 10000L |
47 | #define DELAY 10000L |
| 42 | #define ATTEMPTS 5 |
48 | #define ATTEMPTS 5 |
| 43 | 49 | ||
| 44 | static atomic_t threads_ok; |
50 | static atomic_t threads_ok; |
| Line 103... | Line 109... | ||
| 103 | 109 | ||
| 104 | atomic_inc(&threads_ok); |
110 | atomic_inc(&threads_ok); |
| 105 | } |
111 | } |
| 106 | 112 | ||
| 107 | 113 | ||
| 108 | void test(void) |
114 | void test_sse1(void) |
| 109 | { |
115 | { |
| - | 116 | #ifdef CONFIG_BENCH |
|
| - | 117 | uint64_t t0 = get_cycle(); |
|
| - | 118 | #endif |
|
| 110 | thread_t *t; |
119 | thread_t *t; |
| 111 | int i; |
120 | int i; |
| 112 | 121 | ||
| 113 | waitq_initialize(&can_start); |
122 | waitq_initialize(&can_start); |
| 114 | 123 | ||
| Line 131... | Line 140... | ||
| 131 | 140 | ||
| 132 | while (atomic_get(&threads_ok) != THREADS) |
141 | while (atomic_get(&threads_ok) != THREADS) |
| 133 | ; |
142 | ; |
| 134 | 143 | ||
| 135 | printf("Test passed.\n"); |
144 | printf("Test passed.\n"); |
| - | 145 | #ifdef CONFIG_BENCH |
|
| - | 146 | uint64_t dt = get_cycle() - t0; |
|
| - | 147 | printf("Time: %.*d cycles\n", sizeof(dt) * 2, dt); |
|
| - | 148 | #endif |
|
| 136 | } |
149 | } |
| - | 150 | ||
| - | 151 | #else |
|
| - | 152 | ||
| - | 153 | void test_sse1(void) |
|
| - | 154 | { |
|
| - | 155 | printf("This test is available only on SSE enabled platforms."); |
|
| - | 156 | } |
|
| - | 157 | ||
| - | 158 | #endif |
|