summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2011-08-10 17:11:32 -0700
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:31 -0700
commit9d81e9c52df10f8e7f6d79ca268203eaddc88ddb (patch)
tree95e4e7e534be36ed6a9d5002d0410421473f9c4c /common
parent6d1171e21809aa9c513e896544a4751fe43c5a87 (diff)
Sort the bootstage time summary
Since we can't easily control the order in which records are added to the bootstage list, this sorts the list before display. BUG=chromium-os:17805 TEST=build and boot on Aebl, see that list is sorted Timer summary in microseconds: Mark Elapsed Stage 0 0 reset 316,789 316,789 arch_cpu_init AVP 321,096 4,307 arch_cpu_init A9 321,147 51 arch_cpu_init done 321,149 2 board_init_f start 393,588 72,439 board_init_r start 642,657 249,069 main_loop 647,449 4,792 do_vboot_twostop 649,768 2,319 twostop_init 661,083 11,315 twostop_select_and_set_main_firmware 886,859 225,776 twostop_main_firmware 1,324,964 438,105 select_and_load_kernel_exit 1,328,934 3,970 bootm_start 1,490,433 161,499 start_kernel Change-Id: Ieea6c5f107243d81882207e85775e78924956e34 Reviewed-on: http://gerrit.chromium.org/gerrit/5777 Reviewed-by: Anton Staaf <robotboy@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/bootstage.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/common/bootstage.c b/common/bootstage.c
index 87748595d4..5c1df089d7 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -36,7 +36,7 @@ struct bootstage_record {
const char *name;
};
-static struct bootstage_record record[BOOTSTAGE_COUNT];
+static struct bootstage_record record[BOOTSTAGE_COUNT] = {{1, "avoid_bss"}};
uint32_t bootstage_mark(enum bootstage_id id, const char *name)
{
@@ -77,8 +77,16 @@ static uint32_t print_time_record(enum bootstage_id id,
return rec->time_us;
}
+static int h_compare_record(const void *r1, const void *r2)
+{
+ const struct bootstage_record *rec1 = r1, *rec2 = r2;
+
+ return rec1->time_us - rec2->time_us;
+}
+
void bootstage_report(void)
{
+ struct bootstage_record *rec = record;
int id;
uint32_t prev;
u32 flags = gd->flags;
@@ -89,13 +97,15 @@ void bootstage_report(void)
printf("%11s%11s %s\n", "Mark", "Elapsed", "Stage");
/* Fake the first record - we could get it from early boot */
- prev = 0;
- record[BOOTSTAGE_AWAKE].name = "awake";
+ rec->name = "reset";
+ rec->time_us = 0;
+ prev = print_time_record(BOOTSTAGE_AWAKE, rec, 0);
- for (id = 0; id < BOOTSTAGE_COUNT; id++) {
- struct bootstage_record *rec = &record[id];
+ /* Sort records by increasing time */
+ qsort(record, BOOTSTAGE_COUNT, ARRAY_SIZE(record), h_compare_record);
- if (id == BOOTSTAGE_AWAKE || rec->time_us != 0)
+ for (id = 0; id < BOOTSTAGE_COUNT; id++, rec++) {
+ if (rec->time_us != 0)
prev = print_time_record(id, rec, prev);
}
if (flags & GD_FLG_SILENT)