#3456 assigned enhancement

Add support for CPU counter timestamps

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

Description

The original use case for the CPU counter was low level profiling of SMP synchronization primitives and busy wait loops for device drivers.

For low overhead timestamps the CPU counter may be also used, e.g. for tracing. To support timestamps, the CPU counter must increment monotonically within the whole range of the CPU counter data type, e.g. 32-bit unsigned integer. In addition, it should not be affected by power saving states of the processor.

Change History (7)

comment:1 Changed on Jun 19, 2018 at 4:58:16 AM by Sebastian Huber <sebastian.huber@…>

In 4c7b18e3/rtems:

Add RTEMS_SYSINIT_CPU_COUNTER

Add initialization step for the CPU counter support.

Update #3456.

comment:2 Changed on Jun 19, 2018 at 4:58:29 AM by Sebastian Huber <sebastian.huber@…>

In 65f868c/rtems:

Add _CPU_Counter_frequency()

Add rtems_counter_frequency() API function. Use it to initialize the
counter value converter via the new system initialization step
(RTEMS_SYSINIT_CPU_COUNTER). This decouples the counter implementation
and the counter converter. It avoids an unnecessary pull in of the
64-bit integer division from libgcc.

Update #3456.

comment:3 Changed on Jun 19, 2018 at 4:58:39 AM by Sebastian Huber <sebastian.huber@…>

In 6d130e6/rtems-docs:

c-user: Document RTEMS_SYSINIT_CPU_COUNTER

Update #3456.

comment:4 Changed on Jun 19, 2018 at 4:58:41 AM by Sebastian Huber <sebastian.huber@…>

In 762fa62/rtems:

arm: Simplify CPU counter support

Use the standard ARMv7-M systick module for the ARMv7-M CPU counter
instead of DWT counter since the DWT counter is affected by power saving
states.

Use an inline function for _CPU_Counter_difference() for all ARM BSPs.

Update #3456.

comment:5 Changed on Sep 20, 2018 at 5:28:13 AM by Sebastian Huber <sebastian.huber@…>

In b3cf79b/rtems:

bsp/leon3: Fix typo which breaks the CPU counter

Update #3456.

comment:6 Changed on Dec 7, 2018 at 1:33:54 PM by Sebastian Huber <sebastian.huber@…>

In 0a1f5df9/rtems:

Simplify _CPU_Counter_difference()

In order to simplify the use of CPU counter values it is beneficial to
have monotonic increasing values within the range of the CPU counter
ticks data type, e.g. 32-bit unsigned integer. This eases the use of
CPU counter timestamps in external tools which do not know the details
of the CPU counter hardware. The CPU counter is the fastest way to get
a time on an RTEMS system.

Such a CPU counter may be also used as the timecounter. Use it on SPARC
for this purpose to simplify the clock drivers.

Update #3456.

comment:7 Changed on Feb 7, 2019 at 7:48:53 AM by Sebastian Huber <sebastian.huber@…>

In 0fb52ce/rtems:

bsps/arm: Fix generic timer frequency

Update #3456.

Note: See TracTickets for help on using tickets.