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