mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/4] clock: Add a variable with the first timestamp after startup
Date: Tue, 30 Sep 2014 16:22:03 +0200	[thread overview]
Message-ID: <1412086926-27167-2-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1412086926-27167-1-git-send-email-s.hauer@pengutronix.de>

For measuring the startup time it's useful to save the first
timestamp after the clocksource has been registered.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/clock.c  | 8 ++++++++
 include/clock.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/common/clock.c b/common/clock.c
index 9c7c1ba..2dae9ff 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -29,6 +29,12 @@
 static struct clocksource *current_clock;
 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;
+
 /**
  * get_time_ns - get current timestamp in nanoseconds
  */
@@ -180,5 +186,7 @@ EXPORT_SYMBOL(mdelay);
 int init_clock(struct clocksource *cs)
 {
 	current_clock = cs;
+	time_beginning = get_time_ns();
+
 	return 0;
 }
diff --git a/include/clock.h b/include/clock.h
index a169790..691befc 100644
--- a/include/clock.h
+++ b/include/clock.h
@@ -43,6 +43,8 @@ void mdelay(unsigned long msecs);
 #define MSECOND ((uint64_t)(1000 * 1000))
 #define USECOND ((uint64_t)(1000))
 
+extern uint64_t time_beginning;
+
 /*
  * Convenience wrapper to implement a typical polling loop with
  * timeout. returns 0 if the condition became true within the
-- 
2.1.0


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

  reply	other threads:[~2014-09-30 14:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-30 14:22 dmesg Support Sascha Hauer
2014-09-30 14:22 ` Sascha Hauer [this message]
2014-09-30 14:22 ` [PATCH 2/4] clock: make get_time_ns() safe to be called without clocksource Sascha Hauer
2014-09-30 14:22 ` [PATCH 3/4] startup: Don't print multiple lines with pr_info Sascha Hauer
2014-09-30 14:22 ` [PATCH 4/4] Introduce message logging support Sascha Hauer

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=1412086926-27167-2-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --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