[coreboot-gerrit] Patch set updated for coreboot: cbmem: export base_time in timestamp table

Aaron Durbin (adurbin@chromium.org) gerrit at coreboot.org
Mon Jul 13 17:35:31 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/10883

-gerrit

commit 72c643d0963454c22022307bf89d53ae25bd4877
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Sat Jul 11 12:44:10 2015 -0500

    cbmem: export base_time in timestamp table
    
    It's helpful to know the base_time (1st timestamp) in the
    timestamp table because it provides more information like
    the accumulated time before the first timestamp was recorded.
    
    In order to maximize this information report the base time
    as an entry that is printed. It's called '1st timestamp'.
    The implementation turns all the timestamp entries into absolute
    times so one can observe both absolute and relative time for
    each marker.
    
    Change-Id: I1334a2d980e3bcc2968a3bd6493c68b9efcca7ae
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
---
 util/cbmem/cbmem.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 3bc0fcd..80bf673 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -396,6 +396,8 @@ static const struct timestamp_id_to_name {
 	u32 id;
 	const char *name;
 } timestamp_ids[] = {
+	/* Marker to report base_time. */
+	{ 0,			"1st timestamp" },
 	{ TS_START_ROMSTAGE,	"start of rom stage" },
 	{ TS_BEFORE_INITRAM,	"before ram initialization" },
 	{ TS_AFTER_INITRAM,	"after ram initialization" },
@@ -487,6 +489,7 @@ static void dump_timestamps(void)
 	int i;
 	struct timestamp_table *tst_p;
 	size_t size;
+	uint64_t prev_stamp;
 
 	if (timestamps.tag != LB_TAG_TIMESTAMPS) {
 		fprintf(stderr, "No timestamps found in coreboot table.\n");
@@ -502,10 +505,19 @@ static void dump_timestamps(void)
 	unmap_memory();
 	tst_p = map_memory_size((unsigned long)timestamps.cbmem_addr, size);
 
+	/* Report the base time within the table. */
+	prev_stamp = 0;
+	timestamp_print_entry(0,  tst_p->base_time, prev_stamp);
+	prev_stamp = tst_p->base_time;
+
 	for (i = 0; i < tst_p->num_entries; i++) {
-		const struct timestamp_entry *tse_p = tst_p->entries + i;
-		timestamp_print_entry(tse_p->entry_id, tse_p->entry_stamp,
-			i ? tse_p[-1].entry_stamp : 0);
+		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);
+		prev_stamp = stamp;
 	}
 
 	unmap_memory();



More information about the coreboot-gerrit mailing list