Skip to content

Commit

Permalink
logging: fix timestamp scaling with 64-bit timestamp
Browse files Browse the repository at this point in the history
In default_get_timestamp(), sys_clock_tick_get() is returned when
CONFIG_LOG_TIMESTAMP_64BIT=y. The timestamp frequency should reflect this.

(cherry picked from commit 7188f92)

Original-Signed-off-by: Xudong Zheng <7pkvm5aw@slicealias.com>
GitOrigin-RevId: 7188f92
Change-Id: Ibf6ff034ff08a59d16212e0a09390df4630197c1
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/4851933
Commit-Queue: Keith Short <keithshort@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Keith Short <keithshort@chromium.org>
  • Loading branch information
xudongzheng authored and Chromeos LUCI committed Sep 8, 2023
1 parent e27df66 commit 8ae118c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions subsys/logging/log_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit 8ae118c

Please sign in to comment.