Mercurial > ecos
comparison packages/kernel/current/tests/tm_basic.cxx @ 34:29bc183297e1 ecos-sw-1999-09-02
Merge from eCos master repository on 1999-09-02-16:26:10-BST
| author | jlarmour |
|---|---|
| date | Thu, 02 Sep 1999 16:11:22 +0000 |
| parents | d3fbcdfa1b2f |
| children | e7ba79f6d3a8 |
comparison
equal
deleted
inserted
replaced
| 33:7a567ebab069 | 34:29bc183297e1 |
|---|---|
| 138 static fun_times alarm_ft[NALARMS]; | 138 static fun_times alarm_ft[NALARMS]; |
| 139 | 139 |
| 140 static long rtc_resolution[] = CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION; | 140 static long rtc_resolution[] = CYGNUM_KERNEL_COUNTERS_RTC_RESOLUTION; |
| 141 static long ns_per_system_clock; | 141 static long ns_per_system_clock; |
| 142 | 142 |
| 143 #ifdef HAL_CLOCK_LATENCY | 143 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) |
| 144 // Data kept by kernel real time clock measuring clock interrupt latency | 144 // Data kept by kernel real time clock measuring clock interrupt latency |
| 145 extern cyg_tick_count total_clock_latency, total_clock_interrupts; | 145 extern cyg_tick_count total_clock_latency, total_clock_interrupts; |
| 146 extern cyg_int32 min_clock_latency, max_clock_latency; | 146 extern cyg_int32 min_clock_latency, max_clock_latency; |
| 147 extern bool measure_clock_latency; | |
| 148 #endif | |
| 149 | |
| 150 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) | |
| 151 extern cyg_tick_count total_clock_dsr_latency, total_clock_dsr_calls; | |
| 152 extern cyg_int32 min_clock_dsr_latency, max_clock_dsr_latency; | |
| 147 extern bool measure_clock_latency; | 153 extern bool measure_clock_latency; |
| 148 #endif | 154 #endif |
| 149 | 155 |
| 150 externC void diag_printf(const char *, ...); | 156 externC void diag_printf(const char *, ...); |
| 151 | 157 |
| 196 // | 202 // |
| 197 // The measurements are reenabled after the printing, thus allowing for | 203 // The measurements are reenabled after the printing, thus allowing for |
| 198 // fair measurements of the kernel primitives, which are not distorted | 204 // fair measurements of the kernel primitives, which are not distorted |
| 199 // by the printing mechanisms. | 205 // by the printing mechanisms. |
| 200 | 206 |
| 201 #ifdef HAL_CLOCK_LATENCY | 207 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 202 void | 208 void |
| 203 disable_clock_latency_measurement(void) | 209 disable_clock_latency_measurement(void) |
| 204 { | 210 { |
| 205 wait_for_tick(); | 211 wait_for_tick(); |
| 206 measure_clock_latency = false; | 212 measure_clock_latency = false; |
| 220 disable_clock_latency_measurement(); | 226 disable_clock_latency_measurement(); |
| 221 total_clock_latency = 0; | 227 total_clock_latency = 0; |
| 222 total_clock_interrupts = 0; | 228 total_clock_interrupts = 0; |
| 223 min_clock_latency = 0x7FFFFFFF; | 229 min_clock_latency = 0x7FFFFFFF; |
| 224 max_clock_latency = 0; | 230 max_clock_latency = 0; |
| 231 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) | |
| 232 total_clock_dsr_latency = 0; | |
| 233 total_clock_dsr_calls = 0; | |
| 234 min_clock_dsr_latency = 0x7FFFFFFF; | |
| 235 max_clock_dsr_latency = 0; | |
| 236 #endif | |
| 225 enable_clock_latency_measurement(); | 237 enable_clock_latency_measurement(); |
| 238 | |
| 226 } | 239 } |
| 227 #else | 240 #else |
| 228 #define disable_clock_latency_measurement() | 241 #define disable_clock_latency_measurement() |
| 229 #define enable_clock_latency_measurement() | 242 #define enable_clock_latency_measurement() |
| 230 #define reset_clock_latency_measurement() | 243 #define reset_clock_latency_measurement() |
| 1431 cyg_uint32 min_stack, max_stack, total_stack, actual_stack; | 1444 cyg_uint32 min_stack, max_stack, total_stack, actual_stack; |
| 1432 cyg_tick_count_t ticks, tick0, tick1; | 1445 cyg_tick_count_t ticks, tick0, tick1; |
| 1433 #ifdef CYG_SCHEDULER_LOCK_TIMINGS | 1446 #ifdef CYG_SCHEDULER_LOCK_TIMINGS |
| 1434 cyg_uint32 lock_ave, lock_max; | 1447 cyg_uint32 lock_ave, lock_max; |
| 1435 #endif | 1448 #endif |
| 1436 #ifdef HAL_CLOCK_LATENCY | 1449 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 1437 cyg_int32 clock_ave; | 1450 cyg_int32 clock_ave; |
| 1438 #endif | 1451 #endif |
| 1439 | 1452 |
| 1440 disable_clock_latency_measurement(); | 1453 disable_clock_latency_measurement(); |
| 1441 | 1454 |
| 1509 diag_printf(", Ave lock:"); | 1522 diag_printf(", Ave lock:"); |
| 1510 show_ticks_in_us(lock_ave); | 1523 show_ticks_in_us(lock_ave); |
| 1511 diag_printf("\n"); | 1524 diag_printf("\n"); |
| 1512 #endif | 1525 #endif |
| 1513 | 1526 |
| 1514 #ifdef HAL_CLOCK_LATENCY | 1527 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_LATENCY) && defined(HAL_CLOCK_LATENCY) |
| 1515 // Display latency figures in same format as all other numbers | 1528 // Display latency figures in same format as all other numbers |
| 1516 disable_clock_latency_measurement(); | 1529 disable_clock_latency_measurement(); |
| 1517 clock_ave = (total_clock_latency*1000) / total_clock_interrupts; | 1530 clock_ave = (total_clock_latency*1000) / total_clock_interrupts; |
| 1518 show_ticks_in_us(clock_ave); | 1531 show_ticks_in_us(clock_ave); |
| 1519 show_ticks_in_us(min_clock_latency*1000); | 1532 show_ticks_in_us(min_clock_latency*1000); |
| 1520 show_ticks_in_us(max_clock_latency*1000); | 1533 show_ticks_in_us(max_clock_latency*1000); |
| 1521 show_ticks_in_us(0); | 1534 show_ticks_in_us(0); |
| 1522 diag_printf(" Clock/interrupt latency\n\n"); | 1535 diag_printf(" Clock/interrupt latency\n\n"); |
| 1536 enable_clock_latency_measurement(); | |
| 1537 #endif | |
| 1538 | |
| 1539 #if defined(CYGVAR_KERNEL_COUNTERS_CLOCK_DSR_LATENCY) | |
| 1540 disable_clock_latency_measurement(); | |
| 1541 clock_ave = (total_clock_dsr_latency*1000) / total_clock_dsr_calls; | |
| 1542 show_ticks_in_us(clock_ave); | |
| 1543 show_ticks_in_us(min_clock_dsr_latency*1000); | |
| 1544 show_ticks_in_us(max_clock_dsr_latency*1000); | |
| 1545 show_ticks_in_us(0); | |
| 1546 diag_printf(" Clock DSR latency\n\n"); | |
| 1523 enable_clock_latency_measurement(); | 1547 enable_clock_latency_measurement(); |
| 1524 #endif | 1548 #endif |
| 1525 | 1549 |
| 1526 disable_clock_latency_measurement(); | 1550 disable_clock_latency_measurement(); |
| 1527 min_stack = STACK_SIZE; | 1551 min_stack = STACK_SIZE; |
