mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jules Maselbas <jmaselbas@kalray.eu>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@kalray.eu>
Subject: [PATCH 3/4] clock: Remove time_beginning
Date: Thu, 25 Mar 2021 14:38:36 +0100	[thread overview]
Message-ID: <20210325133837.30866-3-jmaselbas@kalray.eu> (raw)
In-Reply-To: <20210325133837.30866-1-jmaselbas@kalray.eu>

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@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



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


  parent reply	other threads:[~2021-03-25 13:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-25 13:38 [PATCH 1/4] clock: Change cyc2ns return type to uint64_t Jules Maselbas
2021-03-25 13:38 ` [PATCH 2/4] clock: Update cs->cycle_last when switching clock Jules Maselbas
2021-03-25 13:38 ` Jules Maselbas [this message]
2021-03-25 13:38 ` [PATCH 4/4] common: common_console: Rework log_print Jules Maselbas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210325133837.30866-3-jmaselbas@kalray.eu \
    --to=jmaselbas@kalray.eu \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox