#2840 closed enhancement (fixed)

Use self-contained mutexes for Termios framework

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 5.1
Component: dev/serial Version:
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

Use C11 mutexes instead of Classic semaphores as a performance optimization and to simplify the application configuration.

A performance of Classic semaphores vs. C11 mutexes was measured on the arm/atsam BSP. A NXP SC16IS752 was connected via SPI. The RTEMS application used one task to read from the device and write it immediately back (look back via task). A development system constantly transmitted data at 115200 bits per second.

CPU usage by function with Classic semaphores:

name______________________________________|ratio___|1%_____2%________5%_____10%_____20%_______50%___100|
CPU_Thread_Idle_body                      | 22.454%|=================================                  |
atsam_spi_setup_transfer                  |  6.767%|====================                               |
Objects_Get                               |  5.859%|===================                                |
atsam_spi_interrupt                       |  4.483%|================                                   |
Event_Seize                               |  3.867%|==============                                     |
rtems_termios_enqueue_raw_characters      |  3.804%|==============                                     |
Timecounter_Binuptime                     |  3.715%|==============                                     |
Scheduler_priority_Block                  |  3.104%|============                                       |
rtems_semaphore_release                   |  3.018%|============                                       |
Scheduler_priority_Unblock                |  2.901%|===========                                        |
rtems_termios_read_tty                    |  2.777%|===========                                        |
ARMV7M_NVIC_Interrupt_dispatch            |  2.750%|===========                                        |
rtems_semaphore_obtain                    |  2.627%|==========                                         |
Thread_Do_dispatch                        |  2.351%|=========                                          |
ARMV7M_Interrupt_service_leave            |  2.086%|========                                           |
iproc                                     |  1.919%|=======                                            |
CPU_Context_switch                        |  

CPU usage by function with C11 mutexes:

name______________________________________|ratio___|1%_____2%________5%_____10%_____20%_______50%___100|
CPU_Thread_Idle_body                      | 33.395%|======================================             |
atsam_spi_setup_transfer                  |  6.061%|===================                                |
atsam_spi_interrupt                       |  4.690%|================                                   |
Mutex_recursive_Release                   |  3.011%|============                                       |
Event_Seize                               |  2.955%|===========                                        |
ARMV7M_NVIC_Interrupt_dispatch            |  2.885%|===========                                        |
rtems_termios_enqueue_raw_characters      |  2.771%|===========                                        |
rtems_termios_read_tty                    |  2.722%|===========                                        |
Timecounter_Binuptime                     |  2.653%|==========                                         |
Thread_Do_dispatch                        |  2.240%|========                                           |
Scheduler_priority_Block                  |  2.112%|========                                           |
ARMV7M_Interrupt_service_leave            |  2.100%|========                                           |
Scheduler_priority_Unblock                |  1.919%|=======                                            |
Mutex_recursive_Acquire                   |  1.876%|======                                             |
iproc                                     |  1.773%|======                                             |
CPU_Context_switch                        |  

The change resulted in 10% more total idle time on the system.

Change History (6)

comment:1 Changed on May 11, 2017 at 7:31:02 AM by Sebastian Huber

Milestone: 4.124.12.0

comment:2 Changed on May 11, 2017 at 7:42:40 AM by Sebastian Huber

Milestone: 4.12.05.0

comment:3 Changed on Aug 14, 2017 at 12:12:55 AM by Chris Johns

Milestone: 5.0Indefinite
Version: 4.11

comment:4 Changed on Feb 2, 2018 at 2:22:00 PM by Sebastian Huber <sebastian.huber@…>

In 2c12262/rtems:

termios: Use self-contained objects

Update #2840.

comment:5 Changed on Feb 5, 2018 at 10:50:41 AM by Sebastian Huber

Component: scoredev/serial
Milestone: Indefinite5.1
Resolution: fixed
Status: newclosed
Summary: Use C11 mutexes for Termios frameworkUse self-contained mutexes for Termios framework

Fixed by #2843.

comment:6 Changed on Feb 22, 2018 at 3:42:52 PM by Sebastian Huber <sebastian.huber@…>

In 5618997d/rtems:

termios: Fix use of uninitialized variable

Update #2840.

Note: See TracTickets for help on using tickets.