Commit Graph

4 Commits

Author SHA1 Message Date
Daniel Leung 1559712b22 timing: add kconfig CONFIG_TIMING_FUNCTIONS_NEED_AT_BOOT
This adds a new kconfig CONFIG_TIMING_FUNCTIONS_NEED_AT_BOOT so
that the timing subsystem can be initialized at boot, instead of
being #ifdef under thread runtime statistics. This will allow
other part of kernel and other subsystems to utilize the timing
functions.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-04-06 16:43:55 -04:00
Daniel Leung 6ab4886506 timing: fix timing_stop() ref counting
When there are more timing_stop() calls then timing_start(),
the reference counter will go negative, resulting in the next
timing_start() call not starting the timer. Without timer
running, getting cycles elasped would not work. So fix
the ref counting so it won't dip below zero.

Fixes #30397

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-01-04 12:15:30 +01:00
Daniel Leung 9be37553ee timing: do not repeatedly do init()/start()/stop()
We should not be initializing/starting/stoping timing functions
multiple times. So this changes how the timing functions are
structured to allow only one initialization, only start when
stopped, and only stop when started.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2020-11-11 23:55:49 -05:00
Daniel Leung 0ffcfa9633 timing: introduce timing functions as a generic feature
Add timing functions and APIs.  This is now used with some of the tests
we have for performance and metrics and will be used whereever timing
informations are needed, for example for tracing, profiling and other
operations where timing info is critical.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2020-09-05 13:28:38 -05:00