summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJonas Aaberg <jonas.aberg@stericsson.com>2010-07-06 15:02:49 +0200
committerMichael BRANDT <michael.brandt@stericsson.com>2010-07-23 14:39:17 +0200
commit9946602dce35ee6b949eb9df77fc2e42566b51b7 (patch)
treef501ec2f2608eb99042a865ecc8aed15c224acc6 /common
parent10a69883f1f80384e5352d666be91f78ef7de3e4 (diff)
boottime: Minor clean up and added u-boot command for displaying the current boot time status.
Change-Id: Ifdfea22cc1d587469a18b22a20c0dc14aeaa49c9 Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2502 Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com>
Diffstat (limited to 'common')
-rw-r--r--common/boottime.c33
-rw-r--r--common/main.c2
2 files changed, 26 insertions, 9 deletions
diff --git a/common/boottime.c b/common/boottime.c
index 8aa29a643..8381ad249 100644
--- a/common/boottime.c
+++ b/common/boottime.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009-2010 ST-Ericsson AB
+ * Copyright (C) ST-Ericsson SA 2009-2010
* Jonas Aaberg <jonas.aberg@stericsson.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -18,7 +18,6 @@
*
*/
-
#include <common.h>
#include <boottime.h>
#include <asm/byteorder.h>
@@ -29,11 +28,11 @@ static struct tag_boottime boottime = {
.total = 0,
};
-int boottime_tag(char *name)
+void boottime_tag(char *name)
{
if (boottime.num == BOOTTIME_MAX) {
printf("boottime: out of entries!\n");
- return -1;
+ return;
}
strncpy((char *)boottime.entry[boottime.num].name,
@@ -43,10 +42,8 @@ int boottime_tag(char *name)
boottime.entry[boottime.num].time = get_timer_us();
boottime.num++;
- return 0;
}
-
struct boottime_entry *boottime_get_entry(unsigned int i)
{
if (i >= boottime.num)
@@ -55,7 +52,6 @@ struct boottime_entry *boottime_get_entry(unsigned int i)
return &boottime.entry[i];
}
-
void boottime_idle_add(unsigned long time)
{
boottime.idle += time;
@@ -77,7 +73,30 @@ void boottime_remove_last(void)
boottime.num--;
}
+static int do_boottime(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ unsigned int i;
+ struct boottime_entry *entry;
+
+ for (i = 0; i < BOOTTIME_MAX; i++) {
+ entry = boottime_get_entry(i);
+ if (entry == NULL)
+ break;
+ printf("%s: started at %lu ms\n", entry->name,
+ (unsigned long)entry->time / 1000);
+ }
+ printf("idle: %d%% (%d ms)\n",
+ 100 * (int)boottime_idle_get() / (int)get_timer_us(),
+ (int)boottime_idle_get() / 1000);
+ return 0;
+}
+U_BOOT_CMD(
+ boottime, 1, 1, do_boottime,
+ "print boottime info",
+ ""
+ " - print boottime tags\n"
+);
diff --git a/common/main.c b/common/main.c
index 88e7fd2e9..548c7a89e 100644
--- a/common/main.c
+++ b/common/main.c
@@ -216,9 +216,7 @@ static __inline__ int abortboot(int bootdelay)
{
int abort = 0;
-#ifdef CONFIG_BOOTTIME
boottime_tag("autoboot_delay");
-#endif
#ifdef CONFIG_MENUPROMPT
printf(CONFIG_MENUPROMPT);