summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorBora Guvendik <bora.guvendik@intel.com>2022-02-10 20:13:50 -0800
committerJulius Werner <jwerner@chromium.org>2022-03-21 20:30:05 +0000
commitc79da5f2119df8255ab336cea9f8da8cb974cdf8 (patch)
tree4106fc6b99735c3311c7bd6fa270edec44236ebb /util
parentfc45b1b90b1dd50e9ed6c9f88e355c4d66d553f7 (diff)
util/cbmem: Keep original Total Time calculation when no negative timestamps
"Total time" calculation changed after CL 59555 to include "1st timestamp" value in the calculation. This patch restores original Total Time calculation where "1st timetamp" is subtracted from "jumping to kernel". If pre CPU reset timestamps are added (negative timestamps), "Total time" calculation still includes the pre-reset time as expected. 1) Before https://review.coreboot.org/c/coreboot/+/59555: 0:1st timestamp 225,897 1101:jumping to kernel 1,238,218 (16,316) Total Time: 1,012,281 2) After https://review.coreboot.org/c/coreboot/+/59555: 0:1st timestamp 225,897 1101:jumping to kernel 1,238,218 (16,316) Total Time: 1,238,178 3) After this patch: 0:1st timestamp 225,897 (0) 1101:jumping to kernel 1,238,218 (16,316) Total Time: 1,012,281 BUG=none TEST=Boot to OS, check cbmem -t on Redrix board Signed-off-by: Bora Guvendik <bora.guvendik@intel.com> Change-Id: I0442f796b03731df3b869aea32d40ed94cabdce0 Reviewed-on: https://review.coreboot.org/c/coreboot/+/61839 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-by: Paul Menzel <paulepanter@mailbox.org>
Diffstat (limited to 'util')
-rw-r--r--util/cbmem/cbmem.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index eef68a0772..0fd69d6e06 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -642,9 +642,12 @@ static void dump_timestamps(int mach_readable)
* If there are negative timestamp entries, rebase all of the
* timestamps to the lowest one in the list.
*/
- if (sorted_tst_p->entries[0].entry_stamp < 0)
+ if (sorted_tst_p->entries[0].entry_stamp < 0) {
sorted_tst_p->base_time = -sorted_tst_p->entries[0].entry_stamp;
- prev_stamp = 0;
+ prev_stamp = 0;
+ } else {
+ prev_stamp = tst_p->base_time;
+ }
total_time = 0;
for (uint32_t i = 0; i < sorted_tst_p->num_entries; i++) {