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 --- board/st/u8500/u8500.c | 2 +- common/boottime.c | 33 ++++++++++++++++++++++++++------- common/main.c | 2 -- include/boottime.h | 7 +++---- 4 files changed, 30 insertions(+), 14 deletions(-) diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c index a548f9537..7c47ab977 100644 --- a/board/st/u8500/u8500.c +++ b/board/st/u8500/u8500.c @@ -385,7 +385,7 @@ int board_late_init(void) } #endif /* CONFIG_MMC */ #ifdef CONFIG_VIDEO_LOGO - (void) boottime_tag("splash"); + boottime_tag("splash"); dss_init(); #endif /* 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); diff --git a/include/boottime.h b/include/boottime.h index 907033a6f..95f039170 100644 --- a/include/boottime.h +++ b/include/boottime.h @@ -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 @@ -21,7 +21,6 @@ #ifndef BOOTTIME_H #define BOOTTIME_H - #define BOOTTIME_MAX_NAME_LEN 64 struct boottime_entry { @@ -30,14 +29,14 @@ struct boottime_entry { }; #ifdef CONFIG_BOOTTIME -int boottime_tag(char *name); +void boottime_tag(char *name); void boottime_remove_last(void); struct boottime_entry *boottime_get_entry(unsigned int i); unsigned long boottime_idle_get(void); unsigned long boottime_idle_done(void); void boottime_idle_add(unsigned long time); #else -#define boottime_tag(x) 0 +#define boottime_tag(x) #define boottime_remove_last() #define boottime_idle_add(x) #endif -- cgit v1.2.3