CONFIG_SYS_CLOCK_TICKS_PER_SEC

System tick frequency (in ticks/second)

Type: int

Help

This option specifies the frequency of the system clock in Hz.

Depending on the choice made, an amount of possibly expensive math must occur when converting ticks to milliseconds and vice-versa. Some values are optimized, and yield significantly less math.

The optimal values from a computational point-of-view are 1000, 500, 250 and 125, since in these cases there is either no computation required, or it is all done via bit-shifting. These also give a granularity from 1ms to 8ms.

Other good values are 100, 50, 25, 20 and 10. In this case, some math is required but is minimized. These are also values that necessitate a reduced number of clock interrupts per second, at the cost of granularity (10ms to 100ms).

All other values require some extensive 64-bit math, and in some configurations even require calls to compiler built-in functions, and can require a non-trivial extra amount of stack space (e.g. around 80 bytes on x86).

Note that when available and enabled, in “tickless” mode this config variable specifies the minimum available timing granularity, not necessarily the number or frequency of interrupts delivered to the kernel.

A value of 0 completely disables timer support in the kernel.

Defaults

  • 128
  • 1000
  • 1000
  • 100

Kconfig definitions

At soc/arm/nordic_nrf/Kconfig.defconfig:25

Included via Kconfig:10Kconfig.zephyr:28

Menu path: (Top)

config SYS_CLOCK_TICKS_PER_SEC
    int
    default 128
    depends on SOC_FAMILY_NRF

At soc/arm/nxp_imx/mcimx7_m4/Kconfig.defconfig.mcimx7_m4:14

Included via Kconfig:10Kconfig.zephyr:28soc/arm/nxp_imx/Kconfig.defconfig:7soc/arm/nxp_imx/mcimx7_m4/Kconfig.defconfig.series:18

Menu path: (Top)

config SYS_CLOCK_TICKS_PER_SEC
    int
    default 1000
    depends on SOC_MCIMX7_M4 && SOC_SERIES_IMX7_M4

At soc/arm/ti_simplelink/msp432p4xx/Kconfig.defconfig.msp432p401r:18

Included via Kconfig:10Kconfig.zephyr:28soc/arm/ti_simplelink/Kconfig.defconfig:3soc/arm/ti_simplelink/msp432p4xx/Kconfig.defconfig.series:10

Menu path: (Top)

config SYS_CLOCK_TICKS_PER_SEC
    int
    default 1000
    depends on SOC_MSP432P401R && SOC_SERIES_MSP432P4XX

At kernel/Kconfig:520

Included via Kconfig:10Kconfig.zephyr:36

Menu path: (Top) → General Kernel Options

config SYS_CLOCK_TICKS_PER_SEC
    int "System tick frequency (in ticks/second)"
    default 100
    help
      This option specifies the frequency of the system clock in Hz.

      Depending on the choice made, an amount of possibly expensive math must
      occur when converting ticks to milliseconds and vice-versa. Some values
      are optimized, and yield significantly less math.

      The optimal values from a computational point-of-view are 1000, 500,
      250 and 125, since in these cases there is either no computation
      required, or it is all done via bit-shifting. These also give a
      granularity from 1ms to 8ms.

      Other good values are 100, 50, 25, 20 and 10. In this case, some math
      is required but is minimized. These are also values that necessitate a
      reduced number of clock interrupts per second, at the cost of
      granularity (10ms to 100ms).

      All other values require some extensive 64-bit math, and in some
      configurations even require calls to compiler built-in functions, and
      can require a non-trivial extra amount of stack space (e.g. around 80
      bytes on x86).

      Note that when available and enabled, in "tickless" mode
      this config variable specifies the minimum available timing
      granularity, not necessarily the number or frequency of
      interrupts delivered to the kernel.

      A value of 0 completely disables timer support in the kernel.

(The ‘depends on’ condition includes propagated dependencies from ifs and menus.)