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>
This commit is contained in:
parent
b1536a3298
commit
96cae61eba
|
@ -29,6 +29,12 @@
|
||||||
static struct clocksource *current_clock;
|
static struct clocksource *current_clock;
|
||||||
static uint64_t time_ns;
|
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
|
* get_time_ns - get current timestamp in nanoseconds
|
||||||
*/
|
*/
|
||||||
|
@ -180,5 +186,7 @@ EXPORT_SYMBOL(mdelay);
|
||||||
int init_clock(struct clocksource *cs)
|
int init_clock(struct clocksource *cs)
|
||||||
{
|
{
|
||||||
current_clock = cs;
|
current_clock = cs;
|
||||||
|
time_beginning = get_time_ns();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ void mdelay(unsigned long msecs);
|
||||||
#define MSECOND ((uint64_t)(1000 * 1000))
|
#define MSECOND ((uint64_t)(1000 * 1000))
|
||||||
#define USECOND ((uint64_t)(1000))
|
#define USECOND ((uint64_t)(1000))
|
||||||
|
|
||||||
|
extern uint64_t time_beginning;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convenience wrapper to implement a typical polling loop with
|
* Convenience wrapper to implement a typical polling loop with
|
||||||
* timeout. returns 0 if the condition became true within the
|
* timeout. returns 0 if the condition became true within the
|
||||||
|
|
Loading…
Reference in New Issue