<p>Martin Roth has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/25024">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Timestamps: Add option to print timestamps to debug console<br><br>Prints the timestamp name and value to the debug console if enabled<br>in Kconfig.<br><br>Change-Id: Ie6e6a4877fefec45fb987ceae7d42de6ce768159<br>Signed-off-by: Martin Roth <martinroth@chromium.org><br>---<br>M src/Kconfig<br>M src/lib/timestamp.c<br>2 files changed, 24 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/24/25024/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/Kconfig b/src/Kconfig</span><br><span>index 692a5b7..99a704d 100644</span><br><span>--- a/src/Kconfig</span><br><span>+++ b/src/Kconfig</span><br><span>@@ -185,6 +185,13 @@</span><br><span>          Make coreboot create a table of timer-ID/timer-value pairs to</span><br><span>        allow measuring time spent at different phases of the boot process.</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+config TIMESTAMPS_ON_CONSOLE</span><br><span style="color: hsl(120, 100%, 40%);">+       bool "Print the timestamp values on the console"</span><br><span style="color: hsl(120, 100%, 40%);">+    default n</span><br><span style="color: hsl(120, 100%, 40%);">+     depends on COLLECT_TIMESTAMPS</span><br><span style="color: hsl(120, 100%, 40%);">+ help</span><br><span style="color: hsl(120, 100%, 40%);">+    Print the timestamps to the debug console if enabled at level spew.</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> config USE_BLOBS</span><br><span>  bool "Allow use of binary-only repository"</span><br><span>         help</span><br><span>diff --git a/src/lib/timestamp.c b/src/lib/timestamp.c</span><br><span>index 149b8b8..5a575a5 100644</span><br><span>--- a/src/lib/timestamp.c</span><br><span>+++ b/src/lib/timestamp.c</span><br><span>@@ -154,6 +154,19 @@</span><br><span>         return ts_table;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+static const char *ts_name_unknown = "Unknown timestamp ID";</span><br><span style="color: hsl(120, 100%, 40%);">+static const char *timestamp_name(enum timestamp_id id)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ int i;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+      for (i = 0; i < sizeof(timestamp_ids)/sizeof(timestamp_ids[0]); i++) {</span><br><span style="color: hsl(120, 100%, 40%);">+             if (timestamp_ids[i].id == id)</span><br><span style="color: hsl(120, 100%, 40%);">+                        return timestamp_ids[i].name;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   return ts_name_unknown;</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> static void timestamp_add_table_entry(struct timestamp_table *ts_table,</span><br><span>                                    enum timestamp_id id, uint64_t ts_time)</span><br><span> {</span><br><span>@@ -166,6 +179,10 @@</span><br><span>    tse->entry_id = id;</span><br><span>       tse->entry_stamp = ts_time - ts_table->base_time;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+   if (IS_ENABLED(CONFIG_TIMESTAMPS_ON_CONSOLE))</span><br><span style="color: hsl(120, 100%, 40%);">+         printk(BIOS_SPEW, "%s: %ld\n", timestamp_name(id),</span><br><span style="color: hsl(120, 100%, 40%);">+                          (unsigned long)ts_time);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>   if (ts_table->num_entries == ts_table->max_entries)</span><br><span>            printk(BIOS_ERR, "ERROR: Timestamp table full\n");</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://review.coreboot.org/25024">change 25024</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/25024"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ie6e6a4877fefec45fb987ceae7d42de6ce768159 </div>
<div style="display:none"> Gerrit-Change-Number: 25024 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Martin Roth <martinroth@google.com> </div>