Kyösti Mälkki has uploaded this change for review.

View Change

[WIP] console,boot_state: Reformat state times output

Change-Id: I0c847da98901c56b356b4a933d9ae865dada98b6
Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com>
---
M src/console/printk.c
M src/lib/hardwaremain.c
2 files changed, 14 insertions(+), 17 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/84/36584/1
diff --git a/src/console/printk.c b/src/console/printk.c
index 4f9f547..3fb69cb 100644
--- a/src/console/printk.c
+++ b/src/console/printk.c
@@ -52,7 +52,7 @@
if (!TRACK_CONSOLE_TIME)
return;

- printk(BIOS_DEBUG, "Accumulated console time in " ENV_STRING " %ld ms\n",
+ printk(BIOS_DEBUG, "BS: " ENV_STRING " times (ms) run (unknown) (%ld)\n",
DIV_ROUND_CLOSEST(console_usecs, USECS_PER_MSEC));
}

diff --git a/src/lib/hardwaremain.c b/src/lib/hardwaremain.c
index 3fcf882..c1ea1b3 100644
--- a/src/lib/hardwaremain.c
+++ b/src/lib/hardwaremain.c
@@ -252,26 +252,23 @@

static void bs_report_time(struct boot_state *state)
{
- long entry_time;
- long run_time;
- long exit_time;
struct mono_time *samples = &state->times.samples[0];
+ const char *sample_id[] = { "entry", "run", "exit" };
+ long execution, console;
+ int i;

- entry_time = mono_time_diff_microseconds(&samples[0], &samples[1]);
- run_time = mono_time_diff_microseconds(&samples[1], &samples[2]);
- exit_time = mono_time_diff_microseconds(&samples[2], &samples[3]);
+ for (i = 0; i < MAX_TIME_SAMPLES - 1; i++) {
+ execution = mono_time_diff_microseconds(&samples[i], &samples[i + 1]);
+ console = state->times.console_usecs[i + 1];

- entry_time -= state->times.console_usecs[1];
- run_time -= state->times.console_usecs[2];
- exit_time -= state->times.console_usecs[3];
+ /* Report with millisecond precision to reduce log diffs. */
+ execution = DIV_ROUND_CLOSEST(execution, USECS_PER_MSEC);
+ console = DIV_ROUND_CLOSEST(console, USECS_PER_MSEC);

- /* Report with millisecond precision to reduce log diffs. */
- entry_time = DIV_ROUND_CLOSEST(entry_time, USECS_PER_MSEC);
- run_time = DIV_ROUND_CLOSEST(run_time, USECS_PER_MSEC);
- exit_time = DIV_ROUND_CLOSEST(exit_time, USECS_PER_MSEC);
-
- printk(BIOS_DEBUG, "BS: %s times (ms): entry %ld run %ld exit %ld\n",
- state->name, entry_time, run_time, exit_time);
+ if (execution)
+ printk(BIOS_DEBUG, "BS: %s times (ms): %s %ld (%ld)\n",
+ state->name, sample_id[i], execution - console, console);
+ }
}
#else
static inline void bs_sample_time(struct boot_state *state) {}

To view, visit change 36584. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I0c847da98901c56b356b4a933d9ae865dada98b6
Gerrit-Change-Number: 36584
Gerrit-PatchSet: 1
Gerrit-Owner: Kyösti Mälkki <kyosti.malkki@gmail.com>
Gerrit-MessageType: newchange