[PATCH 3/4] clock: Remove time_beginning

Jules Maselbas jmaselbas at kalray.eu
Thu Mar 25 13:38:36 GMT 2021


The output of the `demsg -t` command will have broken timestamps for
every log entries written (in the log) before switching clock.

The function get_time_ns() is monotonic, thus setting time_beginning
with get_time_ns() when switching clocksource will always result in
time_beginning being greater than every timestamp set before.

Signed-off-by: Jules Maselbas <jmaselbas at kalray.eu>
---
 common/clock.c          | 7 -------
 common/console_common.c | 2 +-
 2 files changed, 1 insertion(+), 8 deletions(-)

diff --git a/common/clock.c b/common/clock.c
index e30c81a37..4dd9377de 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -17,12 +17,6 @@
 
 static uint64_t time_ns;
 
-/*
- * The first timestamp when the clocksource is registered.
- * Useful for measuring the time spent in barebox.
- */
-uint64_t time_beginning;
-
 static uint64_t dummy_read(void)
 {
 	static uint64_t dummy_counter;
@@ -229,7 +223,6 @@ int init_clock(struct clocksource *cs)
 	 */
 	cs->cycle_last = cs->read() & cs->mask;
 	current_clock = cs;
-	time_beginning = get_time_ns();
 
 	return 0;
 }
diff --git a/common/console_common.c b/common/console_common.c
index 48590c522..7e9973ed8 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -188,7 +188,7 @@ void log_print(unsigned flags, unsigned levels)
 	unsigned long last = 0;
 
 	list_for_each_entry(log, &barebox_logbuf, list) {
-		uint64_t diff = log->timestamp - time_beginning;
+		uint64_t diff = log->timestamp;
 		unsigned long difful;
 
 		if (levels && !(levels & (1 << log->level)))
-- 
2.17.1





More information about the barebox mailing list