From 799bf781fdc71baa2332fc75f2a382c15f2ce321 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 6 Aug 2015 13:52:08 -0500 Subject: [PATCH] util/cbmem: accumulate total time for all entries Display the total accumulated time using each timestamp entry. It purposefully doesn't take into account the first timestamp because that can be a platform dependent value that may not contribute to the concept of "total". BUG=None BRANCH=None TEST=Ran cbmem on glados where TSC doesn't reset to 0 on reboots. Clear total value given at end. Original-Change-Id: Idddb8b88d3aaad11d72c58b18e8fd9fd1447a30e Original-Signed-off-by: Aaron Durbin Original-Reviewed-on: https://chromium-review.googlesource.com/291480 Original-Reviewed-by: Duncan Laurie Original-Trybot-Ready: David James Change-Id: I79a0954d3b738323aaebb3e05171bcf639e5d977 Signed-off-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/11202 Tested-by: build bot (Jenkins) Reviewed-by: Patrick Georgi --- util/cbmem/cbmem.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c index a11935ecdc..6526384eed 100644 --- a/util/cbmem/cbmem.c +++ b/util/cbmem/cbmem.c @@ -476,10 +476,11 @@ static const struct timestamp_id_to_name { { TS_FSP_AFTER_FINALIZE, "returning from FspNotify(ReadyToBoot)" } }; -void timestamp_print_entry(uint32_t id, uint64_t stamp, uint64_t prev_stamp) +uint64_t timestamp_print_entry(uint32_t id, uint64_t stamp, uint64_t prev_stamp) { int i; const char *name; + uint64_t step_time; name = ""; for (i = 0; i < ARRAY_SIZE(timestamp_ids); i++) { @@ -492,12 +493,15 @@ void timestamp_print_entry(uint32_t id, uint64_t stamp, uint64_t prev_stamp) printf("%4d:", id); printf("%-50s", name); print_norm(arch_convert_raw_ts_entry(stamp)); + step_time = arch_convert_raw_ts_entry(stamp - prev_stamp); if (prev_stamp) { printf(" ("); - print_norm(arch_convert_raw_ts_entry(stamp - prev_stamp)); + print_norm(step_time); printf(")"); } printf("\n"); + + return step_time; } /* dump the timestamp table */ @@ -507,6 +511,7 @@ static void dump_timestamps(void) struct timestamp_table *tst_p; size_t size; uint64_t prev_stamp; + uint64_t total_time; if (timestamps.tag != LB_TAG_TIMESTAMPS) { fprintf(stderr, "No timestamps found in coreboot table.\n"); @@ -527,16 +532,22 @@ static void dump_timestamps(void) timestamp_print_entry(0, tst_p->base_time, prev_stamp); prev_stamp = tst_p->base_time; + total_time = 0; for (i = 0; i < tst_p->num_entries; i++) { uint64_t stamp; const struct timestamp_entry *tse = &tst_p->entries[i]; /* Make all timestamps absolute. */ stamp = tse->entry_stamp + tst_p->base_time; - timestamp_print_entry(tse->entry_id, stamp, prev_stamp); + total_time += timestamp_print_entry(tse->entry_id, + stamp, prev_stamp); prev_stamp = stamp; } + printf("\nTotal Time: "); + print_norm(total_time); + printf("\n"); + unmap_memory(); }