[coreboot-gerrit] New patch to review for coreboot: util/cbmem: accumulate total time for all entries

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Wed Aug 12 17:52:21 CEST 2015


Aaron Durbin (adurbin at chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/11202

-gerrit

commit 5863d77dbc0d96b5b523d93084d71fce4c1c6824
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Thu Aug 6 13:52:08 2015 -0500

    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 <adurbin at chromium.org>
    Original-Reviewed-on: https://chromium-review.googlesource.com/291480
    Original-Reviewed-by: Duncan Laurie <dlaurie at chromium.org>
    Original-Trybot-Ready: David James <davidjames at chromium.org>
    
    Change-Id: I79a0954d3b738323aaebb3e05171bcf639e5d977
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 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 a11935e..6526384 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 = "<unknown>";
 	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();
 }
 



More information about the coreboot-gerrit mailing list