Changeset 27cfe7c in rtems


Ignore:
Timestamp:
Oct 20, 2017, 6:31:36 AM (17 months ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
master
Children:
e0dc6ef
Parents:
02878626
git-author:
Sebastian Huber <sebastian.huber@…> (10/20/17 06:31:36)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/24/17 07:37:22)
Message:

score: Add _Watchdog_Ticks_per_second

This value is frequently used. Avoid the function call overhead and the
integer division at run-time.

Update #3117.
Update #3182.

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • cpukit/rtems/src/clockgettickspersecond.c

    r02878626 r27cfe7c  
    2020
    2121#include <rtems/rtems/clock.h>
    22 #include <rtems/score/todimpl.h>
    23 #include <rtems/config.h>
    2422
    2523rtems_interval rtems_clock_get_ticks_per_second(void)
    2624{
    27   return TOD_MICROSECONDS_PER_SECOND /
    28     rtems_configuration_get_microseconds_per_tick();
     25  return _Watchdog_Ticks_per_second;
    2926}
  • cpukit/sapi/include/confdefs.h

    r02878626 r27cfe7c  
    22882288  #endif
    22892289
     2290  #define _CONFIGURE_TICKS_PER_SECOND (1000000 / CONFIGURE_MICROSECONDS_PER_TICK)
     2291
    22902292  /** The configures the number of clock ticks per timeslice. */
    22912293  #ifndef CONFIGURE_TICKS_PER_TIMESLICE
     
    31023104  const size_t _Thread_Control_add_on_count =
    31033105    RTEMS_ARRAY_SIZE( _Thread_Control_add_ons );
     3106
     3107  const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
    31043108
    31053109  /**
  • cpukit/score/include/rtems/score/watchdog.h

    r02878626 r27cfe7c  
    159159extern volatile Watchdog_Interval _Watchdog_Ticks_since_boot;
    160160
     161/**
     162 * @brief The watchdog ticks per second.
     163 *
     164 * This constant is defined by the application configuration via
     165 * <rtems/confdefs.h>.
     166 */
     167extern const uint32_t _Watchdog_Ticks_per_second;
     168
    161169/**@}*/
    162170
  • testsuites/sptests/spwatchdog/init.c

    r02878626 r27cfe7c  
    5858}
    5959
     60static void test_watchdog_config( void )
     61{
     62  rtems_test_assert( _Watchdog_Ticks_per_second == 100 );
     63}
     64
    6065static bool test_watchdog_is_inactive( test_watchdog *watchdog )
    6166{
     
    228233  test_watchdog_operations();
    229234  test_watchdog_static_init();
     235  test_watchdog_config();
    230236
    231237  build_time( &time, 12, 31, 1988, 9, 0, 0, 0 );
Note: See TracChangeset for help on using the changeset viewer.