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