Mercurial > ecos
annotate packages/kernel/current/tests/tm_basic.cxx @ 210:d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
| author | jlarmour |
|---|---|
| date | Thu, 23 May 2002 22:59:51 +0000 |
| parents | e0c0827131d1 |
| children | 7ca632b46393 |
| rev | line source |
|---|---|
| 0 | 1 //========================================================================== |
| 2 // | |
| 3 // tm_basic.cxx | |
| 4 // | |
| 5 // Basic timing test / scaffolding | |
| 6 // | |
| 7 //========================================================================== | |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
8 //####ECOSGPLCOPYRIGHTBEGIN#### |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
9 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
10 // This file is part of eCos, the Embedded Configurable Operating System. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
11 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
12 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
13 // eCos is free software; you can redistribute it and/or modify it under |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
14 // the terms of the GNU General Public License as published by the Free |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
15 // Software Foundation; either version 2 or (at your option) any later version. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
16 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
17 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
18 // WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
19 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
20 // for more details. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
21 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
22 // You should have received a copy of the GNU General Public License along |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
23 // with eCos; if not, write to the Free Software Foundation, Inc., |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
24 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
25 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
26 // As a special exception, if other files instantiate templates or use macros |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
27 // or inline functions from this file, or you compile this file and link it |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
28 // with other works to produce a work based on this file, this file does not |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
29 // by itself cause the resulting work to be covered by the GNU General Public |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
30 // License. However the source code for this file must still be made available |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
31 // in accordance with section (3) of the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
32 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
33 // This exception does not invalidate any other reasons why a work based on |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
34 // this file might be covered by the GNU General Public License. |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
35 // |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
36 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc. |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
37 // at http://sources.redhat.com/ecos/ecos-license/ |
|
208
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
38 // ------------------------------------------- |
|
e0c0827131d1
Merge from eCos master repository on 2002-05-20-20:11:54-BST
jlarmour
parents:
177
diff
changeset
|
39 //####ECOSGPLCOPYRIGHTEND#### |
| 0 | 40 //========================================================================== |
| 41 //#####DESCRIPTIONBEGIN#### | |
| 42 // | |
| 43 // Author(s): gthomas | |
| 44 // Contributors: gthomas | |
| 45 // Date: 1998-10-19 | |
| 2 | 46 // Description: Very simple kernel timing test |
| 0 | 47 //####DESCRIPTIONEND#### |
| 48 | |
| 49 #include <pkgconf/kernel.h> | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
50 #include <pkgconf/hal.h> |
| 0 | 51 |
| 52 #include <cyg/kernel/sched.hxx> | |
| 53 #include <cyg/kernel/thread.hxx> | |
| 54 #include <cyg/kernel/thread.inl> | |
| 55 #include <cyg/kernel/mutex.hxx> | |
| 56 #include <cyg/kernel/sema.hxx> | |
| 57 #include <cyg/kernel/sched.inl> | |
| 58 #include <cyg/kernel/clock.hxx> | |
| 59 #include <cyg/kernel/clock.inl> | |
| 60 #include <cyg/kernel/kapi.h> | |
| 61 | |
| 62 #include <cyg/infra/testcase.h> | |
| 2 | 63 |
|
10
d3fbcdfa1b2f
Merge from eCos master repository on 1999-05-29-00:13:11-BST
jlarmour
parents:
8
diff
changeset
|
64 #include <cyg/kernel/test/stackmon.h> |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
65 #include CYGHWR_MEMORY_LAYOUT_H |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
66 |
| 2 | 67 // Define this to see the statistics with the first sample datum removed. |
| 68 // This can expose the effects of caches on the speed of operations. | |
| 69 #undef STATS_WITHOUT_FIRST_SAMPLE | |
| 70 | |
| 71 #if defined(CYGFUN_KERNEL_API_C) && \ | |
| 72 defined(CYGSEM_KERNEL_SCHED_MLQUEUE) && \ | |
| 73 defined(CYGVAR_KERNEL_COUNTERS_CLOCK) && \ | |
|
76
435cced73e2f
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents:
66
diff
changeset
|
74 !defined(CYGDBG_INFRA_DIAG_USE_DEVICE) && \ |
| 2 | 75 (CYGNUM_KERNEL_SCHED_PRIORITIES > 12) |
| 76 | |
| 0 | 77 #define NTHREADS 1 |
| 78 #include "testaux.hxx" | |
| 79 | |
| 80 // Structure used to keep track of times | |
| 81 typedef struct fun_times { | |
| 82 cyg_uint32 start; | |
| 83 cyg_uint32 end; | |
| 84 } fun_times; | |
| 85 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
86 #define STACK_SIZE CYGNUM_HAL_STACK_SIZE_MINIMUM |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
87 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
88 #ifdef CYGMEM_REGION_ram_SIZE |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
89 #define CYG_THREAD_OVERHEAD (STACK_SIZE+sizeof(cyg_thread)+(sizeof(fun_times)*2)) |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
90 #define NTEST_THREADS ((CYGMEM_REGION_ram_SIZE/16)/CYG_THREAD_OVERHEAD) |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
91 #define CYG_MUTEX_OVERHEAD (sizeof(cyg_mutex_t)+sizeof(fun_times)) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
92 #define NMUTEXES ((CYGMEM_REGION_ram_SIZE/16)/CYG_MUTEX_OVERHEAD) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
93 #define CYG_MBOX_OVERHEAD (sizeof(cyg_mbox)+sizeof(fun_times)) |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
94 #define NMBOXES ((CYGMEM_REGION_ram_SIZE/24)/CYG_MBOX_OVERHEAD) |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
95 #define CYG_SEMAPHORE_OVERHEAD (sizeof(cyg_sem_t)+sizeof(fun_times)) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
96 #define NSEMAPHORES ((CYGMEM_REGION_ram_SIZE/16)/CYG_SEMAPHORE_OVERHEAD) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
97 #define CYG_COUNTER_OVERHEAD (sizeof(cyg_counter)+sizeof(fun_times)) |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
98 #define NCOUNTERS ((CYGMEM_REGION_ram_SIZE/24)/CYG_COUNTER_OVERHEAD) |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
99 #define CYG_ALARM_OVERHEAD (sizeof(cyg_alarm)+sizeof(fun_times)) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
100 #define NALARMS ((CYGMEM_REGION_ram_SIZE/16)/CYG_ALARM_OVERHEAD) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
101 #else |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
102 // Defaults |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
103 #define NTEST_THREADS 16 |
| 0 | 104 #define NMUTEXES 32 |
| 105 #define NMBOXES 32 | |
| 106 #define NSEMAPHORES 32 | |
| 107 #define NCOUNTERS 32 | |
| 108 #define NALARMS 32 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
109 #endif |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
110 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
111 #define NSAMPLES 32 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
112 #define NTHREAD_SWITCHES 128 |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
113 #define NSCHEDS 128 |
| 0 | 114 |
| 2 | 115 #define NSAMPLES_SIM 2 |
| 116 #define NTEST_THREADS_SIM 2 | |
| 117 #define NTHREAD_SWITCHES_SIM 4 | |
| 118 #define NMUTEXES_SIM 2 | |
| 119 #define NMBOXES_SIM 2 | |
| 120 #define NSEMAPHORES_SIM 2 | |
| 121 #define NSCHEDS_SIM 4 | |
| 122 #define NCOUNTERS_SIM 2 | |
| 123 #define NALARMS_SIM 2 | |
| 124 | |
| 125 static int nsamples; | |
| 126 static int ntest_threads; | |
| 127 static int nthread_switches; | |
| 128 static int nmutexes; | |
| 129 static int nmboxes; | |
| 130 static int nsemaphores; | |
| 131 static int nscheds; | |
| 132 static int ncounters; | |
| 133 static int nalarms; | |
| 134 | |
| 0 | 135 static char stacks[NTEST_THREADS][STACK_SIZE]; |
| 136 static cyg_thread test_threads[NTEST_THREADS]; | |
| 137 static cyg_handle_t threads[NTEST_THREADS]; | |
| 138 static int overhead; | |
| 139 static cyg_sem_t synchro; | |
| 140 static fun_times thread_ft[NTEST_THREADS]; | |
| 141 | |
| 142 static fun_times test2_ft[NTHREAD_SWITCHES]; | |
| 143 | |
| 144 static cyg_mutex_t test_mutexes[NMUTEXES]; | |
| 145 static fun_times mutex_ft[NMUTEXES]; | |
| 146 static cyg_thread mutex_test_thread; | |
| 147 static cyg_handle_t mutex_test_thread_handle; | |
| 148 | |
| 149 static cyg_mbox test_mboxes[NMBOXES]; | |
| 150 static cyg_handle_t test_mbox_handles[NMBOXES]; | |
| 151 static fun_times mbox_ft[NMBOXES]; | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
152 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT |
| 0 | 153 static cyg_thread mbox_test_thread; |
| 154 static cyg_handle_t mbox_test_thread_handle; | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
155 #endif |
| 0 | 156 |
| 157 static cyg_sem_t test_semaphores[NSEMAPHORES]; | |
| 158 static fun_times semaphore_ft[NSEMAPHORES]; | |
| 159 static cyg_thread semaphore_test_thread; | |
| 160 static cyg_handle_t semaphore_test_thread_handle; | |
| 161 | |
| 162 static fun_times sched_ft[NSCHEDS]; | |
| 163 | |
| 164 static cyg_counter test_counters[NCOUNTERS]; | |
| 165 static cyg_handle_t counters[NCOUNTERS]; | |
| 166 static fun_times counter_ft[NCOUNTERS]; | |
| 167 | |
| 168 static cyg_alarm test_alarms[NALARMS]; | |
| 169 static cyg_handle_t alarms[NALARMS]; | |
| 170 static fun_times alarm_ft[NALARMS]; | |
| 171 | |
| 2 | 172 static long rtc_resolution[] = CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION; |
| 173 static long ns_per_system_clock; | |
| 174 | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
175 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 2 | 176 // Data kept by kernel real time clock measuring clock interrupt latency |
| 177 extern cyg_tick_count total_clock_latency, total_clock_interrupts; | |
| 178 extern cyg_int32 min_clock_latency, max_clock_latency; | |
| 179 extern bool measure_clock_latency; | |
| 180 #endif | |
| 181 | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
182 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY) |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
183 extern cyg_tick_count total_clock_dsr_latency, total_clock_dsr_calls; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
184 extern cyg_int32 min_clock_dsr_latency, max_clock_dsr_latency; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
185 extern bool measure_clock_latency; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
186 #endif |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
187 |
| 0 | 188 externC void diag_printf(const char *, ...); |
| 189 | |
| 190 void run_sched_tests(void); | |
| 191 void run_thread_tests(void); | |
| 192 void run_thread_switch_test(void); | |
| 193 void run_mutex_tests(void); | |
| 194 void run_mutex_circuit_test(void); | |
| 195 void run_mbox_tests(void); | |
| 196 void run_mbox_circuit_test(void); | |
| 197 void run_semaphore_tests(void); | |
| 198 void run_semaphore_circuit_test(void); | |
| 199 void run_counter_tests(void); | |
| 200 void run_alarm_tests(void); | |
| 201 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
202 #ifndef max |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
203 #define max(n,m) (m > n ? n : m) |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
204 #endif |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
205 |
| 0 | 206 // Wait until a clock tick [real time clock] has passed. This should keep it |
| 207 // from happening again during a measurement, thus minimizing any fluctuations | |
| 208 void | |
| 209 wait_for_tick(void) | |
| 210 { | |
| 2 | 211 cyg_tick_count_t tv0, tv1; |
| 212 tv0 = cyg_current_time(); | |
| 0 | 213 while (true) { |
| 2 | 214 tv1 = cyg_current_time(); |
| 215 if (tv1 != tv0) break; | |
| 216 } | |
| 217 } | |
| 218 | |
| 219 // Display a number of ticks as microseconds | |
| 220 // Note: for improved calculation significance, values are kept in ticks*1000 | |
| 221 void | |
| 222 show_ticks_in_us(cyg_uint32 ticks) | |
| 223 { | |
| 224 long long ns; | |
| 225 ns = (ns_per_system_clock * (long long)ticks) / CYGNUM_KERNEL_COUNTERS_RTC_PERIOD; | |
| 226 ns += 5; // for rounding to .01us | |
| 227 diag_printf("%5d.%02d", (int)(ns/1000), (int)((ns%1000)/10)); | |
| 228 } | |
| 229 | |
| 230 // | |
| 231 // If the kernel is instrumented to measure clock interrupt latency, these | |
| 232 // measurements can be drastically perturbed by printing via "diag_printf()" | |
| 233 // since that code may run with interrupts disabled for long periods. | |
| 234 // | |
| 235 // In order to get accurate/reasonable latency figures _for the kernel | |
| 236 // primitive functions beint tested_, the kernel's latency measurements | |
| 237 // are suspended while the printing actually takes place. | |
| 238 // | |
| 239 // The measurements are reenabled after the printing, thus allowing for | |
| 240 // fair measurements of the kernel primitives, which are not distorted | |
| 241 // by the printing mechanisms. | |
| 242 | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
243 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 2 | 244 void |
| 245 disable_clock_latency_measurement(void) | |
| 246 { | |
| 247 wait_for_tick(); | |
| 248 measure_clock_latency = false; | |
| 249 } | |
| 250 | |
| 251 void | |
| 252 enable_clock_latency_measurement(void) | |
| 253 { | |
| 254 wait_for_tick(); | |
| 255 measure_clock_latency = true; | |
| 256 } | |
| 257 | |
| 258 // Ensure that the measurements are reasonable (no startup anomalies) | |
| 259 void | |
| 260 reset_clock_latency_measurement(void) | |
| 261 { | |
| 262 disable_clock_latency_measurement(); | |
| 263 total_clock_latency = 0; | |
| 264 total_clock_interrupts = 0; | |
| 265 min_clock_latency = 0x7FFFFFFF; | |
| 266 max_clock_latency = 0; | |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
267 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY) |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
268 total_clock_dsr_latency = 0; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
269 total_clock_dsr_calls = 0; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
270 min_clock_dsr_latency = 0x7FFFFFFF; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
271 max_clock_dsr_latency = 0; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
272 #endif |
| 2 | 273 enable_clock_latency_measurement(); |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
274 |
| 2 | 275 } |
| 276 #else | |
| 277 #define disable_clock_latency_measurement() | |
| 278 #define enable_clock_latency_measurement() | |
| 279 #define reset_clock_latency_measurement() | |
| 280 #endif | |
| 281 | |
| 282 void | |
| 283 show_times_hdr(void) | |
| 284 { | |
| 285 disable_clock_latency_measurement(); | |
| 286 diag_printf("\n"); | |
| 287 diag_printf(" Confidence\n"); | |
| 288 diag_printf(" Ave Min Max Var Ave Min Function\n"); | |
| 289 diag_printf(" ====== ====== ====== ====== ========== ========\n"); | |
| 290 enable_clock_latency_measurement(); | |
| 291 } | |
| 292 | |
| 293 void | |
| 294 show_times_detail(fun_times ft[], int nsamples, char *title, bool ignore_first) | |
| 295 { | |
| 296 int i, delta, min, max, con_ave, con_min, ave_dev; | |
| 297 int start_sample, total_samples; | |
| 298 cyg_int32 total, ave; | |
| 299 | |
| 300 if (ignore_first) { | |
| 301 start_sample = 1; | |
| 302 total_samples = nsamples-1; | |
| 303 } else { | |
| 304 start_sample = 0; | |
| 305 total_samples = nsamples; | |
| 0 | 306 } |
| 2 | 307 total = 0; |
| 308 min = 0x7FFFFFFF; | |
| 309 max = 0; | |
| 310 for (i = start_sample; i < nsamples; i++) { | |
| 311 if (ft[i].end < ft[i].start) { | |
| 312 // Clock wrapped around (timer tick) | |
| 313 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start; | |
| 314 } else { | |
| 315 delta = ft[i].end - ft[i].start; | |
| 316 } | |
| 317 delta -= overhead; | |
| 318 if (delta < 0) delta = 0; | |
| 319 delta *= 1000; | |
| 320 total += delta; | |
| 321 if (delta < min) min = delta; | |
| 322 if (delta > max) max = delta; | |
| 323 } | |
| 324 ave = total / total_samples; | |
| 325 total = 0; | |
| 326 ave_dev = 0; | |
| 327 for (i = start_sample; i < nsamples; i++) { | |
| 328 if (ft[i].end < ft[i].start) { | |
| 329 // Clock wrapped around (timer tick) | |
| 330 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start; | |
| 331 } else { | |
| 332 delta = ft[i].end - ft[i].start; | |
| 333 } | |
| 334 delta -= overhead; | |
| 335 if (delta < 0) delta = 0; | |
| 336 delta *= 1000; | |
| 337 delta = delta - ave; | |
| 338 if (delta < 0) delta = -delta; | |
| 339 ave_dev += delta; | |
| 340 } | |
| 341 ave_dev /= total_samples; | |
| 342 con_ave = 0; | |
| 343 con_min = 0; | |
| 344 for (i = start_sample; i < nsamples; i++) { | |
| 345 if (ft[i].end < ft[i].start) { | |
| 346 // Clock wrapped around (timer tick) | |
| 347 delta = (ft[i].end+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - ft[i].start; | |
| 348 } else { | |
| 349 delta = ft[i].end - ft[i].start; | |
| 350 } | |
| 351 delta -= overhead; | |
| 352 if (delta < 0) delta = 0; | |
| 353 delta *= 1000; | |
| 354 if ((delta <= (ave+ave_dev)) && (delta >= (ave-ave_dev))) con_ave++; | |
| 355 if ((delta <= (min+ave_dev)) && (delta >= (min-ave_dev))) con_min++; | |
| 356 } | |
| 357 con_ave = (con_ave * 100) / total_samples; | |
| 358 con_min = (con_min * 100) / total_samples; | |
| 359 show_ticks_in_us(ave); | |
| 360 show_ticks_in_us(min); | |
| 361 show_ticks_in_us(max); | |
| 362 show_ticks_in_us(ave_dev); | |
| 363 disable_clock_latency_measurement(); | |
| 364 diag_printf(" %3d%% %3d%%", con_ave, con_min); | |
| 365 diag_printf(" %s\n", title); | |
| 366 enable_clock_latency_measurement(); | |
| 367 } | |
| 368 | |
| 369 void | |
| 370 show_times(fun_times ft[], int nsamples, char *title) | |
| 371 { | |
| 372 show_times_detail(ft, nsamples, title, false); | |
| 373 #ifdef STATS_WITHOUT_FIRST_SAMPLE | |
| 374 show_times_detail(ft, nsamples, "", true); | |
| 375 #endif | |
| 376 } | |
| 377 | |
| 378 void | |
| 379 show_test_parameters(void) | |
| 380 { | |
| 381 disable_clock_latency_measurement(); | |
| 382 diag_printf("\nTesting parameters:\n"); | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
383 diag_printf(" Clock samples: %5d\n", nsamples); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
384 diag_printf(" Threads: %5d\n", ntest_threads); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
385 diag_printf(" Thread switches: %5d\n", nthread_switches); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
386 diag_printf(" Mutexes: %5d\n", nmutexes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
387 diag_printf(" Mailboxes: %5d\n", nmboxes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
388 diag_printf(" Semaphores: %5d\n", nsemaphores); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
389 diag_printf(" Scheduler operations: %5d\n", nscheds); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
390 diag_printf(" Counters: %5d\n", ncounters); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
391 diag_printf(" Alarms: %5d\n", nalarms); |
| 2 | 392 diag_printf("\n"); |
| 393 enable_clock_latency_measurement(); | |
| 394 } | |
| 395 | |
| 396 void | |
| 397 end_of_test_group(void) | |
| 398 { | |
| 399 disable_clock_latency_measurement(); | |
| 400 diag_printf("\n"); | |
| 401 enable_clock_latency_measurement(); | |
| 0 | 402 } |
| 403 | |
| 404 // Compute a name for a thread | |
| 405 char * | |
| 406 thread_name(char *basename, int indx) { | |
| 407 return "<<NULL>>"; // Not currently used | |
| 408 } | |
| 409 | |
| 410 // test0 - null test, never executed | |
| 411 void | |
| 412 test0(cyg_uint32 indx) | |
| 413 { | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
414 #ifndef CYGPKG_KERNEL_SMP_SUPPORT |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
415 // In SMP, somw of these threads will execute |
| 0 | 416 diag_printf("test0.%d executed?\n", indx); |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
417 #endif |
| 0 | 418 cyg_thread_exit(); |
| 419 } | |
| 420 | |
| 421 // test1 - empty test, simply exit. Last thread signals parent. | |
| 422 void | |
| 423 test1(cyg_uint32 indx) | |
| 424 { | |
| 2 | 425 if (indx == (cyg_uint32)(ntest_threads-1)) { |
| 0 | 426 cyg_semaphore_post(&synchro); // Signal that last thread is dying |
| 427 } | |
| 428 cyg_thread_exit(); | |
| 429 } | |
| 430 | |
| 431 // test2 - measure thread switch times | |
| 432 void | |
| 433 test2(cyg_uint32 indx) | |
| 434 { | |
| 435 int i; | |
| 2 | 436 for (i = 0; i < nthread_switches; i++) { |
| 0 | 437 if (indx == 0) { |
| 438 HAL_CLOCK_READ(&test2_ft[i].start); | |
| 439 } else { | |
| 440 HAL_CLOCK_READ(&test2_ft[i].end); | |
| 441 } | |
| 442 cyg_thread_yield(); | |
| 443 } | |
| 444 if (indx == 1) { | |
| 445 cyg_semaphore_post(&synchro); | |
| 446 } | |
| 447 cyg_thread_exit(); | |
| 448 } | |
| 449 | |
| 450 // Full-circuit mutex unlock/lock test | |
| 451 void | |
| 452 mutex_test(cyg_uint32 indx) | |
| 453 { | |
| 454 int i; | |
| 455 cyg_mutex_lock(&test_mutexes[0]); | |
| 2 | 456 for (i = 0; i < nmutexes; i++) { |
| 0 | 457 cyg_semaphore_wait(&synchro); |
| 458 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 459 HAL_CLOCK_READ(&mutex_ft[i].start); | |
| 460 cyg_mutex_unlock(&test_mutexes[0]); | |
| 461 cyg_mutex_lock(&test_mutexes[0]); | |
| 462 cyg_semaphore_post(&synchro); | |
| 463 } | |
| 464 cyg_thread_exit(); | |
| 465 } | |
| 466 | |
| 467 // Full-circuit mbox put/get test | |
| 468 void | |
| 469 mbox_test(cyg_uint32 indx) | |
| 470 { | |
| 471 void *item; | |
| 472 do { | |
| 473 item = cyg_mbox_get(test_mbox_handles[0]); | |
| 474 HAL_CLOCK_READ(&mbox_ft[(int)item].end); | |
| 475 cyg_semaphore_post(&synchro); | |
| 2 | 476 } while ((int)item != (nmboxes-1)); |
| 0 | 477 cyg_thread_exit(); |
| 478 } | |
| 479 | |
| 480 // Full-circuit semaphore post/wait test | |
| 481 void | |
| 482 semaphore_test(cyg_uint32 indx) | |
| 483 { | |
| 484 int i; | |
| 2 | 485 for (i = 0; i < nsemaphores; i++) { |
| 0 | 486 cyg_semaphore_wait(&test_semaphores[0]); |
| 487 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 488 cyg_semaphore_post(&synchro); | |
| 489 } | |
| 490 cyg_thread_exit(); | |
| 491 } | |
| 492 | |
| 2 | 493 // |
| 494 // This set of tests is used to measure kernel primitives that deal with threads | |
| 495 // | |
| 0 | 496 void |
| 497 run_thread_tests(void) | |
| 498 { | |
| 499 int i; | |
| 500 cyg_priority_t prio; | |
| 501 | |
| 502 // Set my priority higher than any I plan to create | |
| 503 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 504 | |
| 505 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 506 for (i = 0; i < ntest_threads; i++) { |
| 0 | 507 HAL_CLOCK_READ(&thread_ft[i].start); |
| 508 cyg_thread_create(10, // Priority - just a number | |
| 509 test0, // entry | |
| 510 i, // index | |
| 511 thread_name("thread", i), // Name | |
| 512 &stacks[i][0], // Stack | |
| 513 STACK_SIZE, // Size | |
| 514 &threads[i], // Handle | |
| 515 &test_threads[i] // Thread data structure | |
| 516 ); | |
| 517 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 518 } | |
| 2 | 519 show_times(thread_ft, ntest_threads, "Create thread"); |
| 0 | 520 |
| 521 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 522 for (i = 0; i < ntest_threads; i++) { |
| 0 | 523 HAL_CLOCK_READ(&thread_ft[i].start); |
| 524 cyg_thread_yield(); | |
| 525 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 526 } | |
| 2 | 527 show_times(thread_ft, ntest_threads, "Yield thread [all suspended]"); |
| 0 | 528 |
| 529 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 530 for (i = 0; i < ntest_threads; i++) { |
| 0 | 531 HAL_CLOCK_READ(&thread_ft[i].start); |
| 532 cyg_thread_suspend(threads[i]); | |
| 533 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 534 } | |
| 2 | 535 show_times(thread_ft, ntest_threads, "Suspend [suspended] thread"); |
| 0 | 536 |
| 537 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 538 for (i = 0; i < ntest_threads; i++) { |
| 0 | 539 HAL_CLOCK_READ(&thread_ft[i].start); |
| 540 cyg_thread_resume(threads[i]); | |
| 541 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 542 } | |
| 2 | 543 show_times(thread_ft, ntest_threads, "Resume thread"); |
| 0 | 544 |
| 545 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 546 for (i = 0; i < ntest_threads; i++) { |
| 0 | 547 HAL_CLOCK_READ(&thread_ft[i].start); |
| 548 cyg_thread_set_priority(threads[i], 11); | |
| 549 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 550 } | |
| 2 | 551 show_times(thread_ft, ntest_threads, "Set priority"); |
| 0 | 552 |
| 553 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 554 for (i = 0; i < ntest_threads; i++) { |
| 0 | 555 HAL_CLOCK_READ(&thread_ft[i].start); |
| 556 prio = cyg_thread_get_priority(threads[i]); | |
| 557 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 558 } | |
| 2 | 559 show_times(thread_ft, ntest_threads, "Get priority"); |
| 0 | 560 |
| 561 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 562 for (i = 0; i < ntest_threads; i++) { |
| 0 | 563 HAL_CLOCK_READ(&thread_ft[i].start); |
| 564 cyg_thread_kill(threads[i]); | |
| 565 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 566 } | |
| 2 | 567 show_times(thread_ft, ntest_threads, "Kill [suspended] thread"); |
| 0 | 568 |
| 569 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 570 for (i = 0; i < ntest_threads; i++) { |
| 0 | 571 HAL_CLOCK_READ(&thread_ft[i].start); |
| 572 cyg_thread_yield(); | |
| 573 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 574 } | |
| 2 | 575 show_times(thread_ft, ntest_threads, "Yield [no other] thread"); |
| 0 | 576 |
| 577 // Set my priority higher than any I plan to create | |
| 578 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 579 | |
| 580 // Recreate the test set | |
| 2 | 581 for (i = 0; i < ntest_threads; i++) { |
| 0 | 582 cyg_thread_create(10, // Priority - just a number |
| 583 test0, // entry | |
| 584 i, // index | |
| 585 thread_name("thread", i), // Name | |
| 586 &stacks[i][0], // Stack | |
| 587 STACK_SIZE, // Size | |
| 588 &threads[i], // Handle | |
| 589 &test_threads[i] // Thread data structure | |
| 590 ); | |
| 591 } | |
| 592 | |
| 593 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 594 for (i = 0; i < ntest_threads; i++) { |
| 595 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 596 cyg_thread_resume(threads[i]); | |
| 597 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 598 } | |
| 599 show_times(thread_ft, ntest_threads, "Resume [suspended low prio] thread"); | |
| 600 | |
| 601 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 602 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 603 HAL_CLOCK_READ(&thread_ft[i].start); |
| 604 cyg_thread_resume(threads[i]); | |
| 605 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 606 } | |
| 2 | 607 show_times(thread_ft, ntest_threads, "Resume [runnable low prio] thread"); |
| 0 | 608 |
| 609 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 610 for (i = 0; i < ntest_threads; i++) { |
| 0 | 611 HAL_CLOCK_READ(&thread_ft[i].start); |
| 2 | 612 cyg_thread_suspend(threads[i]); |
| 0 | 613 HAL_CLOCK_READ(&thread_ft[i].end); |
| 614 } | |
| 2 | 615 show_times(thread_ft, ntest_threads, "Suspend [runnable] thread"); |
| 616 | |
| 0 | 617 |
| 618 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 619 for (i = 0; i < ntest_threads; i++) { |
| 620 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 621 cyg_thread_yield(); | |
| 622 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 623 } | |
| 624 show_times(thread_ft, ntest_threads, "Yield [only low prio] thread"); | |
| 625 | |
| 626 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 627 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 628 HAL_CLOCK_READ(&thread_ft[i].start); |
| 629 cyg_thread_suspend(threads[i]); | |
| 630 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 631 } | |
| 2 | 632 show_times(thread_ft, ntest_threads, "Suspend [runnable->not runnable]"); |
| 633 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 634 cyg_thread_resume(threads[i]); |
| 635 } | |
| 636 | |
| 637 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 638 for (i = 0; i < ntest_threads; i++) { |
| 0 | 639 HAL_CLOCK_READ(&thread_ft[i].start); |
| 640 cyg_thread_kill(threads[i]); | |
| 641 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 642 } | |
| 2 | 643 show_times(thread_ft, ntest_threads, "Kill [runnable] thread"); |
| 644 | |
| 645 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 646 for (i = 0; i < ntest_threads; i++) { | |
| 647 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 648 cyg_thread_delete(threads[i]); | |
| 649 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 650 } | |
| 651 show_times(thread_ft, ntest_threads, "Destroy [dead] thread"); | |
| 652 | |
| 653 // Recreate the test set | |
| 654 for (i = 0; i < ntest_threads; i++) { | |
| 655 cyg_thread_create(10, // Priority - just a number | |
| 656 test0, // entry | |
| 657 i, // index | |
| 658 thread_name("thread", i), // Name | |
| 659 &stacks[i][0], // Stack | |
| 660 STACK_SIZE, // Size | |
| 661 &threads[i], // Handle | |
| 662 &test_threads[i] // Thread data structure | |
| 663 ); | |
| 664 cyg_thread_resume(threads[i]); | |
| 665 } | |
| 666 | |
| 667 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 668 for (i = 0; i < ntest_threads; i++) { | |
| 669 HAL_CLOCK_READ(&thread_ft[i].start); | |
| 670 cyg_thread_delete(threads[i]); | |
| 671 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 672 } | |
| 673 show_times(thread_ft, ntest_threads, "Destroy [runnable] thread"); | |
| 674 | |
| 0 | 675 // Set my priority lower than any I plan to create |
| 676 cyg_thread_set_priority(cyg_thread_self(), 3); | |
| 677 | |
| 678 // Set up the end-of-threads synchronizer | |
| 679 cyg_semaphore_init(&synchro, 0); | |
| 680 | |
| 681 // Recreate the test set | |
| 2 | 682 for (i = 0; i < ntest_threads; i++) { |
| 0 | 683 cyg_thread_create(2, // Priority - just a number |
| 684 test1, // entry | |
| 685 i, // index | |
| 686 thread_name("thread", i), // Name | |
| 687 &stacks[i][0], // Stack | |
| 688 STACK_SIZE, // Size | |
| 689 &threads[i], // Handle | |
| 690 &test_threads[i] // Thread data structure | |
| 691 ); | |
| 692 } | |
| 693 | |
| 694 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 695 for (i = 0; i < ntest_threads; i++) { |
| 0 | 696 HAL_CLOCK_READ(&thread_ft[i].start); |
| 697 cyg_thread_resume(threads[i]); | |
| 698 HAL_CLOCK_READ(&thread_ft[i].end); | |
| 699 } | |
| 2 | 700 show_times(thread_ft, ntest_threads, "Resume [high priority] thread"); |
| 0 | 701 cyg_semaphore_wait(&synchro); // Wait for all threads to finish |
| 702 // Make sure they are all dead | |
| 2 | 703 for (i = 0; i < ntest_threads; i++) { |
| 704 cyg_thread_delete(threads[i]); | |
| 0 | 705 } |
| 706 | |
| 707 run_thread_switch_test(); | |
| 2 | 708 end_of_test_group(); |
| 0 | 709 } |
| 710 | |
| 711 void | |
| 712 run_thread_switch_test(void) | |
| 713 { | |
| 714 int i; | |
| 715 | |
| 716 // Set up for thread context switch | |
| 717 for (i = 0; i < 2; i++) { | |
| 718 cyg_thread_create(10, // Priority - just a number | |
| 719 test2, // entry | |
| 720 i, // index | |
| 721 thread_name("thread", i), // Name | |
| 722 &stacks[i][0], // Stack | |
| 723 STACK_SIZE, // Size | |
| 724 &threads[i], // Handle | |
| 725 &test_threads[i] // Thread data structure | |
| 726 ); | |
| 727 cyg_thread_resume(threads[i]); | |
| 728 } | |
| 729 // Set up the end-of-threads synchronizer | |
| 730 cyg_semaphore_init(&synchro, 0); | |
| 731 cyg_semaphore_wait(&synchro); | |
| 732 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 733 show_times(test2_ft, nthread_switches, "Thread switch"); |
| 0 | 734 // Clean up |
| 735 for (i = 0; i < 2; i++) { | |
| 2 | 736 cyg_thread_delete(threads[i]); |
| 0 | 737 } |
| 738 } | |
| 739 | |
| 740 void | |
| 741 run_mutex_tests(void) | |
| 742 { | |
| 743 int i; | |
| 744 | |
| 745 // Mutex primitives | |
| 746 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 747 for (i = 0; i < nmutexes; i++) { |
| 0 | 748 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 749 cyg_mutex_init(&test_mutexes[i]); | |
| 750 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 751 } | |
| 2 | 752 show_times(mutex_ft, nmutexes, "Init mutex"); |
| 0 | 753 |
| 754 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 755 for (i = 0; i < nmutexes; i++) { |
| 0 | 756 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 757 cyg_mutex_lock(&test_mutexes[i]); | |
| 758 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 759 } | |
| 2 | 760 show_times(mutex_ft, nmutexes, "Lock [unlocked] mutex"); |
| 0 | 761 |
| 762 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 763 for (i = 0; i < nmutexes; i++) { |
| 0 | 764 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 765 cyg_mutex_unlock(&test_mutexes[i]); | |
| 766 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 767 } | |
| 2 | 768 show_times(mutex_ft, nmutexes, "Unlock [locked] mutex"); |
| 0 | 769 |
| 770 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 771 for (i = 0; i < nmutexes; i++) { |
| 0 | 772 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 773 cyg_mutex_trylock(&test_mutexes[i]); | |
| 774 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 775 } | |
| 2 | 776 show_times(mutex_ft, nmutexes, "Trylock [unlocked] mutex"); |
| 0 | 777 |
| 778 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 779 for (i = 0; i < nmutexes; i++) { |
| 0 | 780 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 781 cyg_mutex_trylock(&test_mutexes[i]); | |
| 782 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 783 } | |
| 2 | 784 show_times(mutex_ft, nmutexes, "Trylock [locked] mutex"); |
| 0 | 785 |
|
38
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
786 // Must unlock mutices before destroying them. |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
787 for (i = 0; i < nmutexes; i++) { |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
788 cyg_mutex_unlock(&test_mutexes[i]); |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
789 } |
|
e7ba79f6d3a8
Merge from eCos master repository on 1999-09-23-20:10:25-BST
jlarmour
parents:
34
diff
changeset
|
790 |
| 0 | 791 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 2 | 792 for (i = 0; i < nmutexes; i++) { |
| 0 | 793 HAL_CLOCK_READ(&mutex_ft[i].start); |
| 794 cyg_mutex_destroy(&test_mutexes[i]); | |
| 795 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 796 } | |
| 2 | 797 show_times(mutex_ft, nmutexes, "Destroy mutex"); |
| 0 | 798 run_mutex_circuit_test(); |
| 2 | 799 end_of_test_group(); |
| 0 | 800 } |
| 801 | |
| 802 void | |
| 803 run_mutex_circuit_test(void) | |
| 804 { | |
| 805 int i; | |
| 806 // Set my priority lower than any I plan to create | |
| 807 cyg_thread_set_priority(cyg_thread_self(), 4); | |
| 808 // Set up for full mutex unlock/lock test | |
| 809 cyg_mutex_init(&test_mutexes[0]); | |
| 810 cyg_semaphore_init(&synchro, 0); | |
| 811 cyg_thread_create(3, // Priority - just a number | |
| 812 mutex_test, // entry | |
| 813 0, // index | |
| 814 thread_name("thread", 0), // Name | |
| 815 &stacks[0][0], // Stack | |
| 816 STACK_SIZE, // Size | |
| 817 &mutex_test_thread_handle, // Handle | |
| 818 &mutex_test_thread // Thread data structure | |
| 819 ); | |
| 820 cyg_thread_resume(mutex_test_thread_handle); | |
| 821 // Need to raise priority so that this thread will block on the "lock" | |
| 822 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 823 for (i = 0; i < nmutexes; i++) { |
| 0 | 824 cyg_semaphore_post(&synchro); |
| 825 cyg_mutex_lock(&test_mutexes[0]); | |
| 826 HAL_CLOCK_READ(&mutex_ft[i].end); | |
| 827 cyg_mutex_unlock(&test_mutexes[0]); | |
| 828 cyg_semaphore_wait(&synchro); | |
| 829 } | |
| 2 | 830 cyg_thread_delete(mutex_test_thread_handle); |
| 831 show_times(mutex_ft, nmutexes, "Unlock/Lock mutex"); | |
| 0 | 832 } |
| 833 | |
| 834 void | |
| 835 run_mbox_tests(void) | |
| 836 { | |
| 837 int i, cnt; | |
| 838 void *item; | |
| 839 // Mailbox primitives | |
| 840 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 841 for (i = 0; i < nmboxes; i++) { |
| 0 | 842 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 843 cyg_mbox_create(&test_mbox_handles[i], &test_mboxes[i]); | |
| 844 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 845 } | |
| 2 | 846 show_times(mbox_ft, nmboxes, "Create mbox"); |
| 0 | 847 |
| 848 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 849 for (i = 0; i < nmboxes; i++) { |
| 0 | 850 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 851 cnt = cyg_mbox_peek(test_mbox_handles[i]); | |
| 852 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 853 } | |
| 2 | 854 show_times(mbox_ft, nmboxes, "Peek [empty] mbox"); |
| 0 | 855 |
| 2 | 856 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT |
| 0 | 857 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 2 | 858 for (i = 0; i < nmboxes; i++) { |
| 0 | 859 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 860 cyg_mbox_put(test_mbox_handles[i], (void *)i); | |
| 861 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 862 } | |
| 2 | 863 show_times(mbox_ft, nmboxes, "Put [first] mbox"); |
| 0 | 864 |
| 865 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 866 for (i = 0; i < nmboxes; i++) { |
| 0 | 867 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 868 cnt = cyg_mbox_peek(test_mbox_handles[i]); | |
| 869 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 870 } | |
| 2 | 871 show_times(mbox_ft, nmboxes, "Peek [1 msg] mbox"); |
| 0 | 872 |
| 873 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 874 for (i = 0; i < nmboxes; i++) { |
| 875 HAL_CLOCK_READ(&mbox_ft[i].start); | |
| 876 cyg_mbox_put(test_mbox_handles[i], (void *)i); | |
| 877 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 878 } | |
| 879 show_times(mbox_ft, nmboxes, "Put [second] mbox"); | |
| 880 | |
| 881 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 882 for (i = 0; i < nmboxes; i++) { | |
| 883 HAL_CLOCK_READ(&mbox_ft[i].start); | |
| 884 cnt = cyg_mbox_peek(test_mbox_handles[i]); | |
| 885 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 886 } | |
| 887 show_times(mbox_ft, nmboxes, "Peek [2 msgs] mbox"); | |
| 888 | |
| 889 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 890 for (i = 0; i < nmboxes; i++) { | |
| 0 | 891 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 892 item = cyg_mbox_get(test_mbox_handles[i]); | |
| 893 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 894 } | |
| 2 | 895 show_times(mbox_ft, nmboxes, "Get [first] mbox"); |
| 0 | 896 |
| 897 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 898 for (i = 0; i < nmboxes; i++) { |
| 0 | 899 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 900 item = cyg_mbox_get(test_mbox_handles[i]); | |
| 901 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 902 } | |
| 2 | 903 show_times(mbox_ft, nmboxes, "Get [second] mbox"); |
| 904 #endif // ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT | |
| 0 | 905 |
| 906 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 907 for (i = 0; i < nmboxes; i++) { |
| 0 | 908 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 909 cyg_mbox_tryput(test_mbox_handles[i], (void *)i); | |
| 910 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 911 } | |
| 2 | 912 show_times(mbox_ft, nmboxes, "Tryput [first] mbox"); |
| 0 | 913 |
| 914 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 915 for (i = 0; i < nmboxes; i++) { |
| 0 | 916 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 917 item = cyg_mbox_peek_item(test_mbox_handles[i]); | |
| 918 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 919 } | |
| 2 | 920 show_times(mbox_ft, nmboxes, "Peek item [non-empty] mbox"); |
| 0 | 921 |
| 922 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 923 for (i = 0; i < nmboxes; i++) { |
| 0 | 924 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 925 item = cyg_mbox_tryget(test_mbox_handles[i]); | |
| 926 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 927 } | |
| 2 | 928 show_times(mbox_ft, nmboxes, "Tryget [non-empty] mbox"); |
| 0 | 929 |
| 930 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 931 for (i = 0; i < nmboxes; i++) { |
| 0 | 932 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 933 item = cyg_mbox_peek_item(test_mbox_handles[i]); | |
| 934 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 935 } | |
| 2 | 936 show_times(mbox_ft, nmboxes, "Peek item [empty] mbox"); |
| 0 | 937 |
| 938 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 939 for (i = 0; i < nmboxes; i++) { |
| 0 | 940 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 941 item = cyg_mbox_tryget(test_mbox_handles[i]); | |
| 942 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 943 } | |
| 2 | 944 show_times(mbox_ft, nmboxes, "Tryget [empty] mbox"); |
| 0 | 945 |
| 946 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 947 for (i = 0; i < nmboxes; i++) { |
| 0 | 948 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 949 cyg_mbox_waiting_to_get(test_mbox_handles[i]); | |
| 950 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 951 } | |
| 2 | 952 show_times(mbox_ft, nmboxes, "Waiting to get mbox"); |
| 0 | 953 |
| 954 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 955 for (i = 0; i < nmboxes; i++) { |
| 0 | 956 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 957 cyg_mbox_waiting_to_put(test_mbox_handles[i]); | |
| 958 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 959 } | |
| 2 | 960 show_times(mbox_ft, nmboxes, "Waiting to put mbox"); |
| 0 | 961 |
| 962 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 963 for (i = 0; i < nmboxes; i++) { |
| 0 | 964 HAL_CLOCK_READ(&mbox_ft[i].start); |
| 965 cyg_mbox_delete(test_mbox_handles[i]); | |
| 966 HAL_CLOCK_READ(&mbox_ft[i].end); | |
| 967 } | |
| 2 | 968 show_times(mbox_ft, nmboxes, "Delete mbox"); |
| 0 | 969 |
| 970 run_mbox_circuit_test(); | |
| 2 | 971 end_of_test_group(); |
| 0 | 972 } |
| 973 | |
| 974 void | |
| 975 run_mbox_circuit_test(void) | |
| 976 { | |
| 2 | 977 #ifdef CYGMFN_KERNEL_SYNCH_MBOXT_PUT_CAN_WAIT |
| 0 | 978 int i; |
| 979 // Set my priority lower than any I plan to create | |
| 980 cyg_thread_set_priority(cyg_thread_self(), 3); | |
| 981 // Set up for full mbox put/get test | |
| 982 cyg_mbox_create(&test_mbox_handles[0], &test_mboxes[0]); | |
| 983 cyg_semaphore_init(&synchro, 0); | |
| 984 cyg_thread_create(2, // Priority - just a number | |
| 985 mbox_test, // entry | |
| 986 0, // index | |
| 987 thread_name("thread", 0), // Name | |
| 988 &stacks[0][0], // Stack | |
| 989 STACK_SIZE, // Size | |
| 990 &mbox_test_thread_handle, // Handle | |
| 991 &mbox_test_thread // Thread data structure | |
| 992 ); | |
| 993 cyg_thread_resume(mbox_test_thread_handle); | |
| 2 | 994 for (i = 0; i < nmboxes; i++) { |
| 0 | 995 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 996 HAL_CLOCK_READ(&mbox_ft[i].start); | |
| 997 cyg_mbox_put(test_mbox_handles[0], (void *)i); | |
| 998 cyg_semaphore_wait(&synchro); | |
| 999 } | |
| 2 | 1000 cyg_thread_delete(mbox_test_thread_handle); |
| 1001 show_times(mbox_ft, nmboxes, "Put/Get mbox"); | |
| 1002 #endif | |
| 0 | 1003 } |
| 1004 | |
| 1005 void | |
| 1006 run_semaphore_tests(void) | |
| 1007 { | |
| 1008 int i; | |
| 2 | 1009 cyg_count32 sem_val; |
| 0 | 1010 // Semaphore primitives |
| 1011 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1012 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1013 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1014 cyg_semaphore_init(&test_semaphores[i], 0); | |
| 1015 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1016 } | |
| 2 | 1017 show_times(semaphore_ft, nsemaphores, "Init semaphore"); |
| 0 | 1018 |
| 1019 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1020 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1021 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1022 cyg_semaphore_post(&test_semaphores[i]); | |
| 1023 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1024 } | |
| 2 | 1025 show_times(semaphore_ft, nsemaphores, "Post [0] semaphore"); |
| 0 | 1026 |
| 1027 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1028 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1029 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1030 cyg_semaphore_wait(&test_semaphores[i]); | |
| 1031 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1032 } | |
| 2 | 1033 show_times(semaphore_ft, nsemaphores, "Wait [1] semaphore"); |
| 0 | 1034 |
| 1035 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1036 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1037 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1038 cyg_semaphore_trywait(&test_semaphores[i]); | |
| 1039 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1040 } | |
| 2 | 1041 show_times(semaphore_ft, nsemaphores, "Trywait [0] semaphore"); |
| 0 | 1042 |
| 1043 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1044 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1045 cyg_semaphore_post(&test_semaphores[i]); |
| 1046 HAL_CLOCK_READ(&semaphore_ft[i].start); | |
| 1047 cyg_semaphore_trywait(&test_semaphores[i]); | |
| 1048 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1049 } | |
| 2 | 1050 show_times(semaphore_ft, nsemaphores, "Trywait [1] semaphore"); |
| 0 | 1051 |
| 1052 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1053 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1054 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1055 cyg_semaphore_peek(&test_semaphores[i], &sem_val); | |
| 1056 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1057 } | |
| 2 | 1058 show_times(semaphore_ft, nsemaphores, "Peek semaphore"); |
| 0 | 1059 |
| 1060 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1061 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1062 HAL_CLOCK_READ(&semaphore_ft[i].start); |
| 1063 cyg_semaphore_destroy(&test_semaphores[i]); | |
| 1064 HAL_CLOCK_READ(&semaphore_ft[i].end); | |
| 1065 } | |
| 2 | 1066 show_times(semaphore_ft, nsemaphores, "Destroy semaphore"); |
| 0 | 1067 |
| 1068 run_semaphore_circuit_test(); | |
| 2 | 1069 end_of_test_group(); |
| 0 | 1070 } |
| 1071 | |
| 1072 void | |
| 1073 run_semaphore_circuit_test(void) | |
| 1074 { | |
| 1075 int i; | |
| 1076 // Set my priority lower than any I plan to create | |
| 1077 cyg_thread_set_priority(cyg_thread_self(), 3); | |
| 1078 // Set up for full semaphore post/wait test | |
| 1079 cyg_semaphore_init(&test_semaphores[0], 0); | |
| 1080 cyg_semaphore_init(&synchro, 0); | |
| 1081 cyg_thread_create(2, // Priority - just a number | |
| 1082 semaphore_test, // entry | |
| 1083 0, // index | |
| 1084 thread_name("thread", 0), // Name | |
| 1085 &stacks[0][0], // Stack | |
| 1086 STACK_SIZE, // Size | |
| 1087 &semaphore_test_thread_handle, // Handle | |
| 1088 &semaphore_test_thread // Thread data structure | |
| 1089 ); | |
| 1090 cyg_thread_resume(semaphore_test_thread_handle); | |
| 2 | 1091 for (i = 0; i < nsemaphores; i++) { |
| 0 | 1092 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
| 1093 HAL_CLOCK_READ(&semaphore_ft[i].start); | |
| 1094 cyg_semaphore_post(&test_semaphores[0]); | |
| 1095 cyg_semaphore_wait(&synchro); | |
| 1096 } | |
| 2 | 1097 cyg_thread_delete(semaphore_test_thread_handle); |
| 1098 show_times(semaphore_ft, nsemaphores, "Post/Wait semaphore"); | |
| 0 | 1099 } |
| 1100 | |
| 1101 void | |
| 1102 run_counter_tests(void) | |
| 1103 { | |
| 1104 int i; | |
| 2 | 1105 cyg_tick_count_t val=0; |
| 0 | 1106 |
| 1107 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1108 for (i = 0; i < ncounters; i++) { |
| 0 | 1109 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1110 cyg_counter_create(&counters[i], &test_counters[i]); | |
| 1111 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1112 } | |
| 2 | 1113 show_times(counter_ft, ncounters, "Create counter"); |
| 0 | 1114 |
| 1115 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1116 for (i = 0; i < ncounters; i++) { |
| 0 | 1117 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1118 val = cyg_counter_current_value(counters[i]); | |
| 1119 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1120 } | |
| 2 | 1121 show_times(counter_ft, ncounters, "Get counter value"); |
| 0 | 1122 |
| 1123 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1124 for (i = 0; i < ncounters; i++) { |
| 0 | 1125 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1126 cyg_counter_set_value(counters[i], val); | |
| 1127 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1128 } | |
| 2 | 1129 show_times(counter_ft, ncounters, "Set counter value"); |
| 0 | 1130 |
| 1131 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1132 for (i = 0; i < ncounters; i++) { |
| 0 | 1133 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1134 cyg_counter_tick(counters[i]); | |
| 1135 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1136 } | |
| 2 | 1137 show_times(counter_ft, ncounters, "Tick counter"); |
| 0 | 1138 |
| 1139 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1140 for (i = 0; i < ncounters; i++) { |
| 0 | 1141 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1142 cyg_counter_delete(counters[i]); | |
| 1143 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1144 } | |
| 2 | 1145 show_times(counter_ft, ncounters, "Delete counter"); |
| 1146 end_of_test_group(); | |
| 0 | 1147 } |
| 1148 | |
| 1149 // Alarm callback function | |
| 1150 void | |
| 1151 alarm_cb(cyg_handle_t alarm, cyg_addrword_t val) | |
| 1152 { | |
| 1153 // empty call back | |
| 1154 } | |
| 1155 | |
| 1156 // Callback used to test determinancy | |
| 1157 static volatile int alarm_cnt; | |
| 1158 void | |
| 1159 alarm_cb2(cyg_handle_t alarm, cyg_addrword_t indx) | |
| 1160 { | |
| 2 | 1161 if (alarm_cnt == nscheds) return; |
| 0 | 1162 sched_ft[alarm_cnt].start = 0; |
| 1163 HAL_CLOCK_READ(&sched_ft[alarm_cnt++].end); | |
| 2 | 1164 if (alarm_cnt == nscheds) { |
| 0 | 1165 cyg_semaphore_post(&synchro); |
| 1166 } | |
| 1167 } | |
| 1168 | |
|
60
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1169 static void |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1170 alarm_cb3(cyg_handle_t alarm, cyg_addrword_t indx) |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1171 { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1172 if (alarm_cnt == nscheds) { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1173 cyg_semaphore_post(&synchro); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1174 } else { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1175 sched_ft[alarm_cnt].start = 0; |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1176 cyg_thread_resume((cyg_handle_t)indx); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1177 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1178 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1179 |
| 0 | 1180 // Null thread, used to keep scheduler busy |
| 1181 void | |
| 1182 alarm_test(cyg_uint32 id) | |
| 1183 { | |
| 1184 while (true) { | |
| 1185 cyg_thread_yield(); | |
| 1186 } | |
| 1187 } | |
| 1188 | |
|
60
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1189 // Thread that suspends itself at the first opportunity |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1190 void |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1191 alarm_test2(cyg_uint32 id) |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1192 { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1193 cyg_handle_t me = cyg_thread_self(); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1194 while (true) { |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1195 HAL_CLOCK_READ(&sched_ft[alarm_cnt++].end); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1196 cyg_thread_suspend(me); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1197 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1198 } |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1199 |
| 0 | 1200 void |
| 1201 run_alarm_tests(void) | |
| 1202 { | |
| 1203 int i; | |
| 1204 cyg_tick_count_t init_val, step_val; | |
| 1205 cyg_handle_t rtc_handle; | |
| 1206 | |
| 1207 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1208 for (i = 0; i < ncounters; i++) { |
| 0 | 1209 cyg_counter_create(&counters[i], &test_counters[i]); |
| 1210 } | |
| 2 | 1211 for (i = 0; i < nalarms; i++) { |
| 0 | 1212 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1213 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[i], &test_alarms[i]); | |
| 1214 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1215 } | |
| 2 | 1216 show_times(alarm_ft, nalarms, "Create alarm"); |
| 0 | 1217 |
| 1218 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1219 init_val = 0; step_val = 0; | |
| 2 | 1220 for (i = 0; i < nalarms; i++) { |
| 0 | 1221 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1222 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1223 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1224 } | |
| 2 | 1225 show_times(alarm_ft, nalarms, "Initialize alarm"); |
| 0 | 1226 |
| 1227 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1228 init_val = 0; step_val = 0; | |
| 2 | 1229 for (i = 0; i < nalarms; i++) { |
| 0 | 1230 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1231 cyg_alarm_disable(alarms[i]); | |
| 1232 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1233 } | |
| 2 | 1234 show_times(alarm_ft, nalarms, "Disable alarm"); |
| 0 | 1235 |
| 1236 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1237 init_val = 0; step_val = 0; | |
| 2 | 1238 for (i = 0; i < nalarms; i++) { |
| 0 | 1239 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1240 cyg_alarm_enable(alarms[i]); | |
| 1241 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1242 } | |
| 2 | 1243 show_times(alarm_ft, nalarms, "Enable alarm"); |
| 0 | 1244 |
| 1245 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1246 for (i = 0; i < nalarms; i++) { |
| 0 | 1247 HAL_CLOCK_READ(&alarm_ft[i].start); |
| 1248 cyg_alarm_delete(alarms[i]); | |
| 1249 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1250 } | |
| 2 | 1251 show_times(alarm_ft, nalarms, "Delete alarm"); |
| 0 | 1252 |
| 1253 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1254 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 1255 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[0], &test_alarms[0]); | |
| 1256 init_val = 9999; step_val = 9999; | |
| 1257 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1258 cyg_alarm_enable(alarms[0]); | |
| 2 | 1259 for (i = 0; i < ncounters; i++) { |
| 0 | 1260 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1261 cyg_counter_tick(counters[0]); | |
| 1262 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1263 } | |
| 2 | 1264 show_times(counter_ft, ncounters, "Tick counter [1 alarm]"); |
| 0 | 1265 |
| 1266 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1267 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 2 | 1268 for (i = 0; i < nalarms; i++) { |
| 0 | 1269 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[i], &test_alarms[i]); |
| 1270 init_val = 9999; step_val = 9999; | |
| 1271 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1272 cyg_alarm_enable(alarms[i]); | |
| 1273 } | |
| 2 | 1274 for (i = 0; i < ncounters; i++) { |
| 0 | 1275 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1276 cyg_counter_tick(counters[0]); | |
| 1277 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1278 } | |
| 2 | 1279 show_times(counter_ft, ncounters, "Tick counter [many alarms]"); |
| 0 | 1280 |
| 1281 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1282 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 1283 cyg_alarm_create(counters[0], alarm_cb, 0, &alarms[0], &test_alarms[0]); | |
| 1284 init_val = 1; step_val = 1; | |
| 1285 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1286 cyg_alarm_enable(alarms[0]); | |
| 2 | 1287 for (i = 0; i < ncounters; i++) { |
| 0 | 1288 HAL_CLOCK_READ(&counter_ft[i].start); |
| 1289 cyg_counter_tick(counters[0]); | |
| 1290 HAL_CLOCK_READ(&counter_ft[i].end); | |
| 1291 } | |
| 2 | 1292 show_times(counter_ft, ncounters, "Tick & fire counter [1 alarm]"); |
| 0 | 1293 |
| 1294 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1295 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 2 | 1296 for (i = 0; i < nalarms; i++) { |
| 0 | 1297 cyg_alarm_create(counters[0], alarm_cb, i, &alarms[i], &test_alarms[i]); |
| 1298 init_val = 1; step_val = 1; | |
| 1299 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1300 cyg_alarm_enable(alarms[i]); | |
| 1301 } | |
| 2 | 1302 for (i = 0; i < nalarms; i++) { |
| 1303 HAL_CLOCK_READ(&alarm_ft[i].start); | |
| 0 | 1304 cyg_counter_tick(counters[0]); |
| 2 | 1305 HAL_CLOCK_READ(&alarm_ft[i].end); |
| 0 | 1306 } |
| 2 | 1307 for (i = 0; i < nalarms; i++) { |
| 0 | 1308 cyg_alarm_delete(alarms[i]); |
| 1309 } | |
| 2 | 1310 show_times(alarm_ft, nalarms, "Tick & fire counters [>1 together]"); |
| 1311 | |
| 1312 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1313 cyg_counter_create(&counters[0], &test_counters[0]); | |
| 1314 for (i = 0; i < nalarms; i++) { | |
| 1315 cyg_alarm_create(counters[0], alarm_cb, i, &alarms[i], &test_alarms[i]); | |
| 1316 init_val = i+1; step_val = nalarms+1; | |
| 1317 cyg_alarm_initialize(alarms[i], init_val, step_val); | |
| 1318 cyg_alarm_enable(alarms[i]); | |
| 1319 } | |
| 1320 for (i = 0; i < nalarms; i++) { | |
| 1321 HAL_CLOCK_READ(&alarm_ft[i].start); | |
| 1322 cyg_counter_tick(counters[0]); | |
| 1323 HAL_CLOCK_READ(&alarm_ft[i].end); | |
| 1324 } | |
| 1325 for (i = 0; i < nalarms; i++) { | |
| 1326 cyg_alarm_delete(alarms[i]); | |
| 1327 } | |
| 1328 show_times(alarm_ft, nalarms, "Tick & fire counters [>1 separately]"); | |
| 0 | 1329 |
| 1330 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1331 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); | |
| 1332 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]); | |
| 1333 init_val = 5; step_val = 5; alarm_cnt = 0; | |
| 1334 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1335 cyg_semaphore_init(&synchro, 0); | |
| 1336 cyg_alarm_enable(alarms[0]); | |
| 1337 cyg_semaphore_wait(&synchro); | |
| 1338 cyg_alarm_disable(alarms[0]); | |
| 1339 cyg_alarm_delete(alarms[0]); | |
| 2 | 1340 show_times(sched_ft, nscheds, "Alarm latency [0 threads]"); |
| 0 | 1341 |
| 1342 // Set my priority higher than any I plan to create | |
| 1343 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 1344 for (i = 0; i < 2; i++) { | |
| 1345 cyg_thread_create(10, // Priority - just a number | |
| 1346 alarm_test, // entry | |
| 1347 i, // index | |
| 1348 thread_name("thread", i), // Name | |
| 1349 &stacks[i][0], // Stack | |
| 1350 STACK_SIZE, // Size | |
| 1351 &threads[i], // Handle | |
| 1352 &test_threads[i] // Thread data structure | |
| 1353 ); | |
| 1354 cyg_thread_resume(threads[i]); | |
| 1355 } | |
| 1356 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1357 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); | |
| 1358 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]); | |
| 1359 init_val = 5; step_val = 5; alarm_cnt = 0; | |
| 1360 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1361 cyg_semaphore_init(&synchro, 0); | |
| 1362 cyg_alarm_enable(alarms[0]); | |
| 1363 cyg_semaphore_wait(&synchro); | |
| 1364 cyg_alarm_disable(alarms[0]); | |
| 1365 cyg_alarm_delete(alarms[0]); | |
| 2 | 1366 show_times(sched_ft, nscheds, "Alarm latency [2 threads]"); |
| 0 | 1367 for (i = 0; i < 2; i++) { |
| 1368 cyg_thread_suspend(threads[i]); | |
| 2 | 1369 cyg_thread_delete(threads[i]); |
| 0 | 1370 } |
| 1371 | |
| 1372 // Set my priority higher than any I plan to create | |
| 1373 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 1374 for (i = 0; i < ntest_threads; i++) { |
| 0 | 1375 cyg_thread_create(10, // Priority - just a number |
| 1376 alarm_test, // entry | |
| 1377 i, // index | |
| 1378 thread_name("thread", i), // Name | |
| 1379 &stacks[i][0], // Stack | |
| 1380 STACK_SIZE, // Size | |
| 1381 &threads[i], // Handle | |
| 1382 &test_threads[i] // Thread data structure | |
| 1383 ); | |
| 1384 cyg_thread_resume(threads[i]); | |
| 1385 } | |
| 1386 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 1387 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); | |
| 1388 cyg_alarm_create(rtc_handle, alarm_cb2, 0, &alarms[0], &test_alarms[0]); | |
| 1389 init_val = 5; step_val = 5; alarm_cnt = 0; | |
| 1390 cyg_alarm_initialize(alarms[0], init_val, step_val); | |
| 1391 cyg_semaphore_init(&synchro, 0); | |
| 1392 cyg_alarm_enable(alarms[0]); | |
| 1393 cyg_semaphore_wait(&synchro); | |
| 1394 cyg_alarm_disable(alarms[0]); | |
| 1395 cyg_alarm_delete(alarms[0]); | |
| 2 | 1396 show_times(sched_ft, nscheds, "Alarm latency [many threads]"); |
| 1397 for (i = 0; i < ntest_threads; i++) { | |
| 0 | 1398 cyg_thread_suspend(threads[i]); |
| 2 | 1399 cyg_thread_delete(threads[i]); |
| 0 | 1400 } |
|
60
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1401 |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1402 // Set my priority higher than any I plan to create |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1403 cyg_thread_set_priority(cyg_thread_self(), 2); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1404 cyg_thread_create(10, // Priority - just a number |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1405 alarm_test2, // entry |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1406 i, // index |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1407 thread_name("thread", 0), // Name |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1408 &stacks[0][0], // Stack |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1409 STACK_SIZE, // Size |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1410 &threads[0], // Handle |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1411 &test_threads[0] // Thread data structure |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1412 ); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1413 wait_for_tick(); // Wait until the next clock tick to minimize aberations |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1414 cyg_clock_to_counter(cyg_real_time_clock(), &rtc_handle); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1415 cyg_alarm_create(rtc_handle, alarm_cb3, threads[0], &alarms[0], |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1416 &test_alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1417 init_val = 5; step_val = 5; alarm_cnt = 0; |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1418 cyg_alarm_initialize(alarms[0], init_val, step_val); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1419 cyg_semaphore_init(&synchro, 0); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1420 cyg_alarm_enable(alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1421 cyg_semaphore_wait(&synchro); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1422 cyg_alarm_disable(alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1423 cyg_alarm_delete(alarms[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1424 show_times(sched_ft, nscheds, "Alarm -> thread resume latency"); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1425 cyg_thread_suspend(threads[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1426 cyg_thread_delete(threads[0]); |
|
3836136e7743
Merge from eCos master repository on 1999-12-17-19:44:58-GMT
jlarmour
parents:
56
diff
changeset
|
1427 |
| 2 | 1428 end_of_test_group(); |
| 0 | 1429 } |
| 1430 | |
| 1431 void | |
| 1432 run_sched_tests(void) | |
| 1433 { | |
| 1434 int i; | |
| 1435 | |
| 1436 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1437 for (i = 0; i < nscheds; i++) { |
| 0 | 1438 HAL_CLOCK_READ(&sched_ft[i].start); |
| 1439 cyg_scheduler_lock(); | |
| 1440 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1441 cyg_scheduler_unlock(); | |
| 1442 } | |
| 2 | 1443 show_times(sched_ft, nscheds, "Scheduler lock"); |
| 0 | 1444 |
| 1445 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1446 for (i = 0; i < nscheds; i++) { |
| 0 | 1447 cyg_scheduler_lock(); |
| 1448 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1449 cyg_scheduler_unlock(); | |
| 1450 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1451 } | |
| 2 | 1452 show_times(sched_ft, nscheds, "Scheduler unlock [0 threads]"); |
| 0 | 1453 |
| 1454 // Set my priority higher than any I plan to create | |
| 1455 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 1456 for (i = 0; i < 1; i++) { | |
| 1457 cyg_thread_create(10, // Priority - just a number | |
| 1458 test0, // entry | |
| 1459 i, // index | |
| 1460 thread_name("thread", i), // Name | |
| 1461 &stacks[i][0], // Stack | |
| 1462 STACK_SIZE, // Size | |
| 1463 &threads[i], // Handle | |
| 1464 &test_threads[i] // Thread data structure | |
| 1465 ); | |
| 1466 } | |
| 1467 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1468 for (i = 0; i < nscheds; i++) { |
| 0 | 1469 cyg_scheduler_lock(); |
| 1470 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1471 cyg_scheduler_unlock(); | |
| 1472 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1473 } | |
| 2 | 1474 show_times(sched_ft, nscheds, "Scheduler unlock [1 suspended]"); |
| 0 | 1475 for (i = 0; i < 1; i++) { |
| 2 | 1476 cyg_thread_delete(threads[i]); |
| 0 | 1477 } |
| 1478 | |
| 1479 // Set my priority higher than any I plan to create | |
| 1480 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 1481 for (i = 0; i < ntest_threads; i++) { |
| 0 | 1482 cyg_thread_create(10, // Priority - just a number |
| 1483 test0, // entry | |
| 1484 i, // index | |
| 1485 thread_name("thread", i), // Name | |
| 1486 &stacks[i][0], // Stack | |
| 1487 STACK_SIZE, // Size | |
| 1488 &threads[i], // Handle | |
| 1489 &test_threads[i] // Thread data structure | |
| 1490 ); | |
| 1491 } | |
| 1492 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1493 for (i = 0; i < nscheds; i++) { |
| 0 | 1494 cyg_scheduler_lock(); |
| 1495 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1496 cyg_scheduler_unlock(); | |
| 1497 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1498 } | |
| 2 | 1499 show_times(sched_ft, nscheds, "Scheduler unlock [many suspended]"); |
| 1500 for (i = 0; i < ntest_threads; i++) { | |
| 1501 cyg_thread_delete(threads[i]); | |
| 0 | 1502 } |
| 1503 | |
| 1504 // Set my priority higher than any I plan to create | |
| 1505 cyg_thread_set_priority(cyg_thread_self(), 2); | |
| 2 | 1506 for (i = 0; i < ntest_threads; i++) { |
| 0 | 1507 cyg_thread_create(10, // Priority - just a number |
| 1508 test0, // entry | |
| 1509 i, // index | |
| 1510 thread_name("thread", i), // Name | |
| 1511 &stacks[i][0], // Stack | |
| 1512 STACK_SIZE, // Size | |
| 1513 &threads[i], // Handle | |
| 1514 &test_threads[i] // Thread data structure | |
| 1515 ); | |
| 1516 cyg_thread_resume(threads[i]); | |
| 1517 } | |
| 1518 wait_for_tick(); // Wait until the next clock tick to minimize aberations | |
| 2 | 1519 for (i = 0; i < nscheds; i++) { |
| 0 | 1520 cyg_scheduler_lock(); |
| 1521 HAL_CLOCK_READ(&sched_ft[i].start); | |
| 1522 cyg_scheduler_unlock(); | |
| 1523 HAL_CLOCK_READ(&sched_ft[i].end); | |
| 1524 } | |
| 2 | 1525 show_times(sched_ft, nscheds, "Scheduler unlock [many low prio]"); |
| 1526 for (i = 0; i < ntest_threads; i++) { | |
| 1527 cyg_thread_delete(threads[i]); | |
| 0 | 1528 } |
| 2 | 1529 end_of_test_group(); |
| 0 | 1530 } |
| 1531 | |
| 1532 void | |
| 1533 run_all_tests(CYG_ADDRESS id) | |
| 1534 { | |
| 2 | 1535 int i, j; |
| 1536 cyg_uint32 tv[nsamples], tv0, tv1; | |
| 1537 cyg_uint32 min_stack, max_stack, total_stack, actual_stack; | |
| 1538 cyg_tick_count_t ticks, tick0, tick1; | |
| 0 | 1539 #ifdef CYG_SCHEDULER_LOCK_TIMINGS |
| 1540 cyg_uint32 lock_ave, lock_max; | |
| 1541 #endif | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1542 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 0 | 1543 cyg_int32 clock_ave; |
| 1544 #endif | |
| 1545 | |
| 2 | 1546 disable_clock_latency_measurement(); |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1547 |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1548 #ifndef CYGPKG_KERNEL_SMP_SUPPORT |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1549 cyg_test_dump_thread_stack_stats( "Startup, main stack", thread[0] ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1550 cyg_test_dump_interrupt_stack_stats( "Startup" ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1551 cyg_test_dump_idlethread_stack_stats( "Startup" ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1552 cyg_test_clear_interrupt_stack(); |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1553 #endif |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1554 |
| 2 | 1555 diag_printf("\neCos Kernel Timings\n"); |
| 1556 diag_printf("Notes: all times are in microseconds (.000001) unless otherwise stated\n"); | |
| 1557 #ifdef STATS_WITHOUT_FIRST_SAMPLE | |
| 1558 diag_printf(" second line of results have first sample removed\n"); | |
| 1559 #endif | |
| 1560 | |
| 1561 cyg_thread_delay(2); // Make sure the clock is actually running | |
| 1562 | |
| 1563 ns_per_system_clock = 1000000/rtc_resolution[1]; | |
| 1564 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1565 wait_for_tick(); |
| 2 | 1566 for (i = 0; i < nsamples; i++) { |
| 0 | 1567 HAL_CLOCK_READ(&tv[i]); |
| 1568 } | |
| 1569 tv0 = 0; | |
| 2 | 1570 for (i = 1; i < nsamples; i++) { |
| 1571 tv0 += tv[i] - tv[i-1]; | |
| 0 | 1572 } |
| 2 | 1573 end_of_test_group(); |
| 0 | 1574 |
| 2 | 1575 overhead = tv0 / (nsamples-1); |
| 1576 diag_printf("Reading the hardware clock takes %d 'ticks' overhead\n", overhead); | |
| 1577 diag_printf("... this value will be factored out of all other measurements\n"); | |
| 0 | 1578 |
| 1579 // Try and measure how long the clock interrupt handling takes | |
| 2 | 1580 for (i = 0; i < nsamples; i++) { |
| 1581 tick0 = cyg_current_time(); | |
| 1582 while (true) { | |
| 1583 tick1 = cyg_current_time(); | |
| 1584 if (tick0 != tick1) break; | |
| 1585 } | |
| 1586 HAL_CLOCK_READ(&tv[i]); | |
| 0 | 1587 } |
| 2 | 1588 tv1 = 0; |
| 1589 for (i = 0; i < nsamples; i++) { | |
| 1590 tv1 += tv[i] * 1000; | |
| 1591 } | |
| 1592 tv1 = tv1 / nsamples; | |
| 0 | 1593 tv1 -= overhead; // Adjust out the cost of getting the timer value |
| 2 | 1594 diag_printf("Clock interrupt took"); |
| 1595 show_ticks_in_us(tv1); | |
| 1596 diag_printf(" microseconds (%d raw clock ticks)\n", tv1/1000); | |
| 1597 enable_clock_latency_measurement(); | |
| 0 | 1598 |
| 1599 ticks = cyg_current_time(); | |
| 1600 | |
| 1601 show_test_parameters(); | |
| 1602 show_times_hdr(); | |
| 1603 | |
| 2 | 1604 reset_clock_latency_measurement(); |
| 1605 | |
| 0 | 1606 run_thread_tests(); |
| 1607 run_sched_tests(); | |
| 1608 run_mutex_tests(); | |
| 1609 run_mbox_tests(); | |
| 1610 run_semaphore_tests(); | |
| 1611 run_counter_tests(); | |
| 1612 run_alarm_tests(); | |
| 1613 | |
| 1614 #ifdef CYG_SCHEDULER_LOCK_TIMINGS | |
| 1615 Cyg_Scheduler::get_lock_times(&lock_ave, &lock_max); | |
| 2 | 1616 diag_printf("\nMax lock:"); |
| 1617 show_ticks_in_us(lock_max); | |
| 1618 diag_printf(", Ave lock:"); | |
| 1619 show_ticks_in_us(lock_ave); | |
| 1620 diag_printf("\n"); | |
| 0 | 1621 #endif |
| 1622 | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1623 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 2 | 1624 // Display latency figures in same format as all other numbers |
| 1625 disable_clock_latency_measurement(); | |
| 1626 clock_ave = (total_clock_latency*1000) / total_clock_interrupts; | |
| 1627 show_ticks_in_us(clock_ave); | |
| 1628 show_ticks_in_us(min_clock_latency*1000); | |
| 1629 show_ticks_in_us(max_clock_latency*1000); | |
| 1630 show_ticks_in_us(0); | |
| 1631 diag_printf(" Clock/interrupt latency\n\n"); | |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1632 enable_clock_latency_measurement(); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1633 #endif |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1634 |
|
210
d2c90368aeef
Merge from eCos master repository on 2002-05-23-21:39:14-BST
jlarmour
parents:
208
diff
changeset
|
1635 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) && defined(HAL_CLOCK_LATENCY) |
|
34
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1636 disable_clock_latency_measurement(); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1637 clock_ave = (total_clock_dsr_latency*1000) / total_clock_dsr_calls; |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1638 show_ticks_in_us(clock_ave); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1639 show_ticks_in_us(min_clock_dsr_latency*1000); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1640 show_ticks_in_us(max_clock_dsr_latency*1000); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1641 show_ticks_in_us(0); |
|
29bc183297e1
Merge from eCos master repository on 1999-09-02-16:26:10-BST
jlarmour
parents:
10
diff
changeset
|
1642 diag_printf(" Clock DSR latency\n\n"); |
| 2 | 1643 enable_clock_latency_measurement(); |
| 0 | 1644 #endif |
| 1645 | |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1646 #ifndef CYGPKG_KERNEL_SMP_SUPPORT |
| 2 | 1647 disable_clock_latency_measurement(); |
| 1648 min_stack = STACK_SIZE; | |
| 1649 max_stack = 0; | |
| 1650 total_stack = 0; | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1651 for (i = 0; i < (int)NTEST_THREADS; i++) { |
| 2 | 1652 for (j = 0; j < STACK_SIZE; j++) { |
| 1653 if (stacks[i][j]) break; | |
| 1654 } | |
| 1655 actual_stack = STACK_SIZE-j; | |
| 1656 if (actual_stack < min_stack) min_stack = actual_stack; | |
| 1657 if (actual_stack > max_stack) max_stack = actual_stack; | |
| 1658 total_stack += actual_stack; | |
| 1659 } | |
| 1660 for (j = 0; j < STACKSIZE; j++) { | |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1661 if (((char *)stack[0])[j]) break; |
| 2 | 1662 } |
| 1663 diag_printf("%5d %5d %5d (main stack: %5d) Thread stack used (%d total)\n", | |
| 1664 total_stack/NTEST_THREADS, min_stack, max_stack, | |
| 1665 STACKSIZE - j, STACK_SIZE); | |
|
8
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1666 |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1667 cyg_test_dump_thread_stack_stats( "All done, main stack", thread[0] ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1668 cyg_test_dump_interrupt_stack_stats( "All done" ); |
|
ece80412419a
Merge from eCos master repository on 1999-05-21-22:05:54-BST
jlarmour
parents:
4
diff
changeset
|
1669 cyg_test_dump_idlethread_stack_stats( "All done" ); |
|
177
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1670 #endif |
|
4c750ce71ae3
Merge from eCos master repository on 2001-08-10-19:22:57-BST
jlarmour
parents:
161
diff
changeset
|
1671 |
| 2 | 1672 enable_clock_latency_measurement(); |
| 1673 | |
| 0 | 1674 ticks = cyg_current_time(); |
| 2 | 1675 diag_printf("\nTiming complete - %d ms total\n\n", (int)((ticks*ns_per_system_clock)/1000)); |
| 0 | 1676 |
| 1677 CYG_TEST_PASS_FINISH("Basic timing OK"); | |
| 1678 } | |
| 1679 | |
| 1680 void tm_basic_main( void ) | |
| 1681 { | |
| 1682 CYG_TEST_INIT(); | |
| 1683 | |
| 2 | 1684 if (cyg_test_is_simulator) { |
| 1685 nsamples = NSAMPLES_SIM; | |
| 1686 ntest_threads = NTEST_THREADS_SIM; | |
| 1687 nthread_switches = NTHREAD_SWITCHES_SIM; | |
| 1688 nmutexes = NMUTEXES_SIM; | |
| 1689 nmboxes = NMBOXES_SIM; | |
| 1690 nsemaphores = NSEMAPHORES_SIM; | |
| 1691 nscheds = NSCHEDS_SIM; | |
| 1692 ncounters = NCOUNTERS_SIM; | |
| 1693 nalarms = NALARMS_SIM; | |
| 1694 } else { | |
| 1695 nsamples = NSAMPLES; | |
| 1696 ntest_threads = NTEST_THREADS; | |
| 1697 nthread_switches = NTHREAD_SWITCHES; | |
| 1698 nmutexes = NMUTEXES; | |
| 1699 nmboxes = NMBOXES; | |
| 1700 nsemaphores = NSEMAPHORES; | |
| 1701 nscheds = NSCHEDS; | |
| 1702 ncounters = NCOUNTERS; | |
| 1703 nalarms = NALARMS; | |
| 1704 } | |
| 1705 | |
|
56
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1706 // Sanity |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1707 #ifdef WORKHORSE_TEST |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1708 ntest_threads = max(512, ntest_threads); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1709 nmutexes = max(1024, nmutexes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1710 nsemaphores = max(1024, nsemaphores); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1711 nmboxes = max(1024, nmboxes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1712 ncounters = max(1024, ncounters); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1713 nalarms = max(1024, nalarms); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1714 #else |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1715 ntest_threads = max(64, ntest_threads); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1716 nmutexes = max(32, nmutexes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1717 nsemaphores = max(32, nsemaphores); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1718 nmboxes = max(32, nmboxes); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1719 ncounters = max(32, ncounters); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1720 nalarms = max(32, nalarms); |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1721 #endif |
|
755351606154
Merge from eCos master repository on 1999-12-01-18:03:05-GMT
jlarmour
parents:
38
diff
changeset
|
1722 |
| 0 | 1723 new_thread(run_all_tests, 0); |
| 1724 | |
| 1725 Cyg_Scheduler::scheduler.start(); | |
|
4
1d7f19c9e4d1
Merge from eCos master repository on 1999-05-11-21:11:10-BST
jlarmour
parents:
2
diff
changeset
|
1726 |
| 0 | 1727 } |
| 1728 | |
|
130
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1729 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1730 externC void |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1731 cyg_hal_invoke_constructors(); |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1732 #endif |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1733 |
| 0 | 1734 externC void |
| 1735 cyg_start( void ) | |
| 1736 { | |
|
130
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1737 #ifdef CYGSEM_HAL_STOP_CONSTRUCTORS_ON_FLAG |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1738 cyg_hal_invoke_constructors(); |
|
eb9fd8c04db3
Merge from eCos master repository on 2000-10-23-17:01:37-BST
jlarmour
parents:
76
diff
changeset
|
1739 #endif |
| 0 | 1740 tm_basic_main(); |
| 1741 } | |
| 2 | 1742 |
| 1743 #else // CYGFUN_KERNEL_API_C | |
| 1744 | |
| 1745 externC void | |
| 1746 cyg_start( void ) | |
| 1747 { | |
| 1748 CYG_TEST_INIT(); | |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1749 CYG_TEST_NA("Timing tests require:\n" |
|
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1750 "CYGFUN_KERNEL_API_C && \n" |
|
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1751 "CYGSEM_KERNEL_SCHED_MLQUEUE &&\n" |
|
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1752 "CYGVAR_KERNEL_COUNTERS_CLOCK &&\n" |
|
76
435cced73e2f
eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
jlarmour
parents:
66
diff
changeset
|
1753 "!CYGDBG_INFRA_DIAG_USE_DEVICE &&\n" |
|
66
bf00f99aec69
Merge from eCos master repository on 2000-02-02-19:16:44-GMT
jlarmour
parents:
64
diff
changeset
|
1754 "(CYGNUM_KERNEL_SCHED_PRIORITIES > 12)\n"); |
| 2 | 1755 } |
| 1756 #endif // CYGFUN_KERNEL_API_C, etc. | |
| 1757 | |
| 0 | 1758 // EOF tm_basic.cxx |
