summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Roth <martinroth@chromium.org>2018-03-07 15:32:16 -0700
committerMartin Roth <martinroth@google.com>2018-03-09 17:16:21 +0000
commitb22bbe27fc9747928248eb644252129c5e630f0a (patch)
treea9016c1f93a2a95f1df69e96f0f217f949ee624b
parent8da81da3b9400763f066762dbf9a203f3892fabd (diff)
downloadcoreboot-b22bbe27fc9747928248eb644252129c5e630f0a.tar.xz
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@chromium.org> Reviewed-on: https://review.coreboot.org/25024 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
-rw-r--r--src/Kconfig7
-rw-r--r--src/lib/timestamp.c16
2 files changed, 23 insertions, 0 deletions
diff --git a/src/Kconfig b/src/Kconfig
index 692a5b7883..99a704dbd7 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -185,6 +185,13 @@ config COLLECT_TIMESTAMPS
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 149b8b8bbb..2ab725372b 100644
--- a/src/lib/timestamp.c
+++ b/src/lib/timestamp.c
@@ -154,6 +154,18 @@ static struct timestamp_table *timestamp_table_get(void)
return ts_table;
}
+static const char *timestamp_name(enum timestamp_id id)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(timestamp_ids); i++) {
+ if (timestamp_ids[i].id == id)
+ return timestamp_ids[i].name;
+ }
+
+ return "Unknown timestamp ID";
+}
+
static void timestamp_add_table_entry(struct timestamp_table *ts_table,
enum timestamp_id id, uint64_t ts_time)
{
@@ -166,6 +178,10 @@ static void timestamp_add_table_entry(struct timestamp_table *ts_table,
tse->entry_id = id;
tse->entry_stamp = ts_time - ts_table->base_time;
+ if (IS_ENABLED(CONFIG_TIMESTAMPS_ON_CONSOLE))
+ printk(BIOS_SPEW, "Timestamp - %s: %" PRIu64 "\n",
+ timestamp_name(id), ts_time);
+
if (ts_table->num_entries == ts_table->max_entries)
printk(BIOS_ERR, "ERROR: Timestamp table full\n");
}