#3253 assigned defect

Fix execution time in time partitioning environments

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: Indefinite
Component: score Version:
Severity: normal Keywords:
Cc: Blocked By:


Currently, the uptime is used to measure execution times in RTEMS. This could be wrong in time partitioning environments, e.g. the RTEMS application is a hypervisor guest. Here the guest execution may take place in time slots. The _TOD_Get_uptime() is currently used for the rate-monotonic statistics and thread CPU time used. For example:

RTEMS_INLINE_ROUTINE void _Thread_Update_CPU_time_used(
  Thread_Control  *the_thread,
  Per_CPU_Control *cpu
  Timestamp_Control last;
  Timestamp_Control ran;

  last = cpu->cpu_usage_timestamp;
  _TOD_Get_uptime( &cpu->cpu_usage_timestamp );
  _Timestamp_Subtract( &last, &cpu->cpu_usage_timestamp, &ran );
  _Timestamp_Add_to( &the_thread->cpu_time_used, &ran );

One approach to fix this problem would be some notification through a high priority guest interrupt by the hypervisor during time slot begin. However, _Thread_Update_CPU_time_used() is called with guest interrupts disabled.

Another approach would be to introduce a _TOD_Get_system_execution_time() and define this to _TOD_Get_uptime() if RTEMS_PARAVIRT is not defined, otherwise add a new CPU port function _CPU_Get_system_execution_time() which must be provided by the hypervisor guest support.

The difference between system execution time and uptime could be displayed in system diagnostic utilities, e.g. rtems_cpu_usage_report_with_plugin().

Change History (0)

Note: See TracTickets for help on using tickets.