record: Improve uptime association

This commit is contained in:
Sebastian Huber
2024-10-11 05:18:42 +02:00
committed by Chris Johns
parent 4655a7df00
commit d4762dbad1
2 changed files with 13 additions and 7 deletions

View File

@@ -122,7 +122,7 @@ static void set_to_bt_scaler(
uint64_t bin_per_s; uint64_t bin_per_s;
bin_per_s = UINT64_C( 1 ) << 32; bin_per_s = UINT64_C( 1 ) << 32;
ctx->to_bt_scaler = ( ( bin_per_s << 31 ) + frequency - 1 ) / frequency; ctx->to_bt_scaler = ( ( bin_per_s << 31 ) + frequency / 2 ) / frequency;
} }
static bool has_time( rtems_record_event event ) static bool has_time( rtems_record_event event )

View File

@@ -64,6 +64,7 @@ void _Record_Initialize( void )
static void _Record_Watchdog( Watchdog_Control *watchdog ) static void _Record_Watchdog( Watchdog_Control *watchdog )
{ {
ISR_Level level; ISR_Level level;
rtems_record_context context;
sbintime_t now; sbintime_t now;
_ISR_Local_disable( level ); _ISR_Local_disable( level );
@@ -72,15 +73,20 @@ static void _Record_Watchdog( Watchdog_Control *watchdog )
_Watchdog_Get_CPU( watchdog ), _Watchdog_Get_CPU( watchdog ),
_Record_Tick_interval _Record_Tick_interval
); );
_ISR_Local_enable( level );
now = _Timecounter_Sbinuptime(); now = _Timecounter_Sbinuptime();
rtems_record_produce_2( rtems_record_prepare_critical( &context, _Per_CPU_Get() );
rtems_record_add(
&context,
RTEMS_RECORD_UPTIME_LOW, RTEMS_RECORD_UPTIME_LOW,
(uint32_t) ( now >> 0 ), (uint32_t) ( now >> 0 )
);
rtems_record_add(
&context,
RTEMS_RECORD_UPTIME_HIGH, RTEMS_RECORD_UPTIME_HIGH,
(uint32_t) ( now >> 32 ) (uint32_t) ( now >> 32 )
); );
rtems_record_commit_critical( &context );
_ISR_Local_enable( level );
} }
static void _Record_Initialize_watchdogs( void ) static void _Record_Initialize_watchdogs( void )