[coreboot-gerrit] Change in coreboot[master]: Timestamps: Add option to print timestamps to debug console

Martin Roth (Code Review) gerrit at coreboot.org
Wed Mar 7 23:38:58 CET 2018


Martin Roth has uploaded this change for review. ( https://review.coreboot.org/25024


Change subject: Timestamps: Add option to print timestamps to debug console
......................................................................

Timestamps: Add option to print timestamps to debug console

Prints the timestamp name and value to the debug console if enabled
in Kconfig.

Change-Id: Ie6e6a4877fefec45fb987ceae7d42de6ce768159
Signed-off-by: Martin Roth <martinroth at chromium.org>
---
M src/Kconfig
M src/lib/timestamp.c
2 files changed, 24 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/25024/1

diff --git a/src/Kconfig b/src/Kconfig
index 692a5b7..99a704d 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -185,6 +185,13 @@
 	  Make coreboot create a table of timer-ID/timer-value pairs to
 	  allow measuring time spent at different phases of the boot process.
 
+config TIMESTAMPS_ON_CONSOLE
+	bool "Print the timestamp values on the console"
+	default n
+	depends on COLLECT_TIMESTAMPS
+	help
+	  Print the timestamps to the debug console if enabled at level spew.
+
 config USE_BLOBS
 	bool "Allow use of binary-only repository"
 	help
diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c
index 149b8b8..5a575a5 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -154,6 +154,19 @@
 	return ts_table;
 }
 
+static const char *ts_name_unknown = "Unknown timestamp ID";
+static const char *timestamp_name(enum timestamp_id id)
+{
+	int i;
+
+	for (i = 0; i < sizeof(timestamp_ids)/sizeof(timestamp_ids[0]); i++) {
+		if (timestamp_ids[i].id == id)
+			return timestamp_ids[i].name;
+	}
+
+	return ts_name_unknown;
+}
+
 static void timestamp_add_table_entry(struct timestamp_table *ts_table,
 				      enum timestamp_id id, uint64_t ts_time)
 {
@@ -166,6 +179,10 @@
 	tse->entry_id = id;
 	tse->entry_stamp = ts_time - ts_table->base_time;
 
+	if (IS_ENABLED(CONFIG_TIMESTAMPS_ON_CONSOLE))
+		printk(BIOS_SPEW, "%s: %ld\n", timestamp_name(id),
+				(unsigned long)ts_time);
+
 	if (ts_table->num_entries == ts_table->max_entries)
 		printk(BIOS_ERR, "ERROR: Timestamp table full\n");
 }

-- 
To view, visit https://review.coreboot.org/25024
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie6e6a4877fefec45fb987ceae7d42de6ce768159
Gerrit-Change-Number: 25024
Gerrit-PatchSet: 1
Gerrit-Owner: Martin Roth <martinroth at google.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180307/2382186d/attachment.html>


More information about the coreboot-gerrit mailing list