From fae525f5477d4c6f0a1149232bf542e471f400c0 Mon Sep 17 00:00:00 2001 From: Raul E Rangel Date: Thu, 4 Nov 2021 15:57:00 -0600 Subject: lib/thread: Start stopwatch after printk We are currently counting how long it takes to print the waiting message, in addition to the actual time we spent waiting. This results in inflating the measurement by 1.7ms when the serial console is enabled. This CL makes it so the print happens before the stopwatch starts. BUG=b:179699789 TEST=No longer see printk time taken into account on serial console Signed-off-by: Raul E Rangel Change-Id: Ib48e37c1b2cb462d634141bf767673936aa2dd26 Reviewed-on: https://review.coreboot.org/c/coreboot/+/58960 Tested-by: build bot (Jenkins) Reviewed-by: Felix Held Reviewed-by: Rob Barnes --- src/lib/thread.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/thread.c b/src/lib/thread.c index 7d5cdc5b8e..0393ca7db0 100644 --- a/src/lib/thread.c +++ b/src/lib/thread.c @@ -398,10 +398,10 @@ enum cb_err thread_join(struct thread_handle *handle) if (handle->state == THREAD_UNINITIALIZED) return CB_ERR_ARG; - stopwatch_init(&sw); - printk(BIOS_SPEW, "waiting for thread\n"); + stopwatch_init(&sw); + while (handle->state != THREAD_DONE) assert(thread_yield() == 0); -- cgit v1.2.3