logging: fix timestamp scaling with 64-bit timestamp
In default_get_timestamp(), sys_clock_tick_get() is returned when CONFIG_LOG_TIMESTAMP_64BIT=y. The timestamp frequency should reflect this. Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
This commit is contained in:
parent
e6d5b3f9a6
commit
7188f925f9
1 changed files with 3 additions and 2 deletions
|
@ -237,8 +237,9 @@ void log_core_init(void)
|
|||
if (sys_clock_hw_cycles_per_sec() > 1000000) {
|
||||
log_set_timestamp_func(default_lf_get_timestamp, 1000U);
|
||||
} else {
|
||||
log_set_timestamp_func(default_get_timestamp,
|
||||
sys_clock_hw_cycles_per_sec());
|
||||
uint32_t freq = IS_ENABLED(CONFIG_LOG_TIMESTAMP_64BIT) ?
|
||||
CONFIG_SYS_CLOCK_TICKS_PER_SEC : sys_clock_hw_cycles_per_sec();
|
||||
log_set_timestamp_func(default_get_timestamp, freq);
|
||||
}
|
||||
|
||||
if (IS_ENABLED(CONFIG_LOG_MODE_DEFERRED)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue