Talk:4.9 Release Notes
From RTEMSWiki
Nanosecond timing is doing horrible things to context switching timing on pc586, and it isn't scaling. For example (numbers are in iterations/mSecond):
| Machine | Function Calls | Event Send | Context switch |
|---|---|---|---|
| 500 MHz AMD K-2 | 28K | 2,466 | 153 |
| Dell Optiplex desktop | 138K | 6,000 | 240 |
| HP Proliant server | 366K | 15K | 262 |
Not too good. Commenting out this section of code in cpukit/score/src/threaddispatch.c _Thread_Dispatch() had good effects:
#if 0
#ifdef RTEMS_ENABLE_NANOSECOND_CPU_USAGE_STATISTICS
{
struct timespec uptime, ran;
_TOD_Get_uptime( &uptime );
_Timespec_Subtract(&_Thread_Time_of_last_context_switch, &uptime, &ran);
_Timespec_Add_to( &executing->cpu_time_used, &ran );
_Thread_Time_of_last_context_switch = uptime;
}
#else
heir->cup_time_used++;
#endif
#endif
On the Optiplex, context switches/mSec went to over 3,000.
The culprit appears to be the port I/O done by _TOD_Get_uptime(). The chip's just too slow. I suggest backing this change out on i386, or replacing it with a version that looks at the HPET registers on chips that support it.
In the meantime, what's the magic to disabling this? I see a comment in thread.h about defining __RTEMS_USE_TICKS_CPU_USAGE_STATISTICS__, but haven't been smart enough to get it working. --Msouth 23:33, 18 November 2008 (UTC)
Verified the correct way. (../rtems-4.9.0/configure ... USE_TICKS_FOR_CPU_USAGE_STATISTICS=1). On my little 500 MHz box the number of context switches/uSec went from 153 to 1600.