#3456 closed enhancement (fixed)

Add support for CPU counter timestamps

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: score Version: 5
Severity: normal Keywords: qualification
Cc: Blocked By: #3961
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 (13)

comment:1 Changed on 06/19/18 at 04:58:16 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 06/19/18 at 04:58:29 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 06/19/18 at 04:58:39 by Sebastian Huber <sebastian.huber@…>

In 6d130e6/rtems-docs:

c-user: Document RTEMS_SYSINIT_CPU_COUNTER

Update #3456.

comment:4 Changed on 06/19/18 at 04:58:41 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 09/20/18 at 05:28:13 by Sebastian Huber <sebastian.huber@…>

In b3cf79b/rtems:

bsp/leon3: Fix typo which breaks the CPU counter

Update #3456.

comment:6 Changed on 12/07/18 at 13:33:54 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 02/07/19 at 07:48:53 by Sebastian Huber <sebastian.huber@…>

In 0fb52ce/rtems:

bsps/arm: Fix generic timer frequency

Update #3456.

comment:8 Changed on 04/09/19 at 05:32:17 by Sebastian Huber <sebastian.huber@…>

In b8a0a496/rtems:

bsps/arm: Fix ARMv7-M CPU counter

Read the current counter value again after we know that we had an
underflow.

Update #3456.

comment:9 Changed on 04/09/19 at 06:11:42 by Sebastian Huber <sebastian.huber@…>

In 222570a/rtems:

bsps/arm: Optimize ARMv7-M CPU counter

Update #3456.

comment:10 Changed on 12/19/19 at 08:07:34 by Sebastian Huber

Milestone: 5.16.1

comment:11 Changed on 04/20/20 at 06:30:19 by Christian Mauderer

Blocked By: 3961 added

comment:12 Changed on 09/09/22 at 05:46:03 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In 270200e/rtems:

score: Remove _CPU_Counter_difference()

All CPU ports used the same _CPU_Counter_difference() implementation. Remove
this CPU port interface and mandate a monotonically increasing CPU counter.

Close #3456.

comment:13 Changed on 10/31/23 at 11:46:21 by Sebastian Huber

Keywords: qualification added
Note: See TracTickets for help on using tickets.