From 9946602dce35ee6b949eb9df77fc2e42566b51b7 Mon Sep 17 00:00:00 2001 From: Jonas Aaberg Date: Tue, 6 Jul 2010 15:02:49 +0200 Subject: boottime: Minor clean up and added u-boot command for displaying the current boot time status. Change-Id: Ifdfea22cc1d587469a18b22a20c0dc14aeaa49c9 Signed-off-by: Jonas Aaberg Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2502 Reviewed-by: Michael BRANDT --- common/boottime.c | 33 ++++++++++++++++++++++++++------- common/main.c | 2 -- 2 files changed, 26 insertions(+), 9 deletions(-) (limited to 'common') 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 * * This program is free software; you can redistribute it and/or modify @@ -18,7 +18,6 @@ * */ - #include #include #include @@ -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); -- cgit v1.2.3