summaryrefslogtreecommitdiffstats
path: root/common/clock.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-09-30 08:25:55 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-09-30 10:44:15 +0200
commit96cae61eba199b9c3f5451f293cf60db2b535164 (patch)
tree24ed8bc33743dbac1a95937b855f11f5b633d3f8 /common/clock.c
parentb1536a3298e25dfdd0136c0fc8d68d2a12cff63c (diff)
downloadbarebox-96cae61eba199b9c3f5451f293cf60db2b535164.tar.gz
barebox-96cae61eba199b9c3f5451f293cf60db2b535164.tar.xz
clock: Add a variable with the first timestamp after startup
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>
Diffstat (limited to 'common/clock.c')
-rw-r--r--common/clock.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/common/clock.c b/common/clock.c
index 9c7c1ba58c..2dae9ff9ad 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;
}