[Skiboot] [PATCH 2/2] console-log: print full remaining timebase in skiboot log

Stewart Smith stewart at linux.vnet.ibm.com
Wed Oct 12 16:26:19 AEDT 2016


Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 core/console-log.c                      | 2 +-
 core/test/run-console-log-buf-overrun.c | 6 +++---
 core/test/run-console-log-pr_fmt.c      | 6 +++---
 core/test/run-console-log.c             | 6 +++---
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/core/console-log.c b/core/console-log.c
index c70229fe8076..642b39ca7988 100644
--- a/core/console-log.c
+++ b/core/console-log.c
@@ -44,7 +44,7 @@ static int vprlog(int log_level, const char *fmt, va_list ap)
 	if (log_level > (debug_descriptor.console_log_levels >> 4))
 		return 0;
 
-	count = snprintf(buffer, sizeof(buffer), "[%5lu.%06lu,%d] ",
+	count = snprintf(buffer, sizeof(buffer), "[%5lu.%09lu,%d] ",
 			 tb_to_secs(tb), tb_remaining_nsecs(tb), log_level);
 	count+= vsnprintf(buffer+count, sizeof(buffer)-count, fmt, ap);
 
diff --git a/core/test/run-console-log-buf-overrun.c b/core/test/run-console-log-buf-overrun.c
index 847a22c26e00..01fca9b8f6fb 100644
--- a/core/test/run-console-log-buf-overrun.c
+++ b/core/test/run-console-log-buf-overrun.c
@@ -81,10 +81,10 @@ int main(void)
 	huge_tb = 0;
 
 	prlog(PR_EMERG, "Hello World %lu", value);
-	CHECK_ASSERT("[    0.000042,0] Hello World 18446744073709551615");
+	CHECK_ASSERT("[    0.000000042,0] Hello World 18446744073709551615");
 
 	printf("Hello World %lu", value);
-	CHECK_ASSERT("[    0.000042,5] Hello World 18446744073709551615");
+	CHECK_ASSERT("[    0.000000042,5] Hello World 18446744073709551615");
 
 	/*
 	 * Test string of size > 320
@@ -105,7 +105,7 @@ int main(void)
 	 */
 	memset(console_buffer, 0, sizeof(console_buffer));
 
-	prlog(PR_EMERG, "%303s", "Hello World");
+	prlog(PR_EMERG, "%300s", "Hello World");
 	assert(console_buffer[319] == 0);
 
 	/* compare truncated string */
diff --git a/core/test/run-console-log-pr_fmt.c b/core/test/run-console-log-pr_fmt.c
index 92c600d6e202..03ee476f5265 100644
--- a/core/test/run-console-log-pr_fmt.c
+++ b/core/test/run-console-log-pr_fmt.c
@@ -52,7 +52,7 @@ int main(void)
 	debug_descriptor.console_log_levels = 0x75;
 
 	prlog(PR_EMERG, "Hello World");
-	assert(memcmp(console_buffer, "[    0.000042,0] PREFIX: Hello World", strlen("[    0.000042,0] PREFIX: Hello World")) == 0);
+	assert(memcmp(console_buffer, "[    0.000000042,0] PREFIX: Hello World", strlen("[    0.000042,0] PREFIX: Hello World")) == 0);
 	assert(flushed_to_drivers==true);
 
 	memset(console_buffer, 0, sizeof(console_buffer));
@@ -63,11 +63,11 @@ int main(void)
 
 	// Should not be flushed to console
 	prlog(PR_DEBUG, "Hello World");
-	assert(memcmp(console_buffer, "[    0.000042,7] PREFIX: Hello World", strlen("[    0.000042,7] PREFIX: Hello World")) == 0);
+	assert(memcmp(console_buffer, "[    0.000000042,7] PREFIX: Hello World", strlen("[    0.000042,7] PREFIX: Hello World")) == 0);
 	assert(flushed_to_drivers==false);
 
 	printf("Hello World");
-	assert(memcmp(console_buffer, "[    0.000042,5] PREFIX: Hello World", strlen("[    0.000042,5] PREFIX: Hello World")) == 0);
+	assert(memcmp(console_buffer, "[    0.000000042,5] PREFIX: Hello World", strlen("[    0.000042,5] PREFIX: Hello World")) == 0);
 	assert(flushed_to_drivers==true);
 
 	return 0;
diff --git a/core/test/run-console-log.c b/core/test/run-console-log.c
index f9e7b567f070..6d6d366b2140 100644
--- a/core/test/run-console-log.c
+++ b/core/test/run-console-log.c
@@ -52,7 +52,7 @@ int main(void)
 	debug_descriptor.console_log_levels = 0x75;
 
 	prlog(PR_EMERG, "Hello World");
-	assert(memcmp(console_buffer, "[    0.000042,0] Hello World", strlen("[    0.000042,0] Hello World")) == 0);
+	assert(memcmp(console_buffer, "[    0.000000042,0] Hello World", strlen("[    0.000042,0] Hello World")) == 0);
 	assert(flushed_to_drivers==true);
 
 	memset(console_buffer, 0, sizeof(console_buffer));
@@ -63,11 +63,11 @@ int main(void)
 
 	// Should not be flushed to console
 	prlog(PR_DEBUG, "Hello World");
-	assert(memcmp(console_buffer, "[    0.000042,7] Hello World", strlen("[    0.000042,7] Hello World")) == 0);
+	assert(memcmp(console_buffer, "[    0.000000042,7] Hello World", strlen("[    0.000042,7] Hello World")) == 0);
 	assert(flushed_to_drivers==false);
 
 	printf("Hello World");
-	assert(memcmp(console_buffer, "[    0.000042,5] Hello World", strlen("[    0.000042,5] Hello World")) == 0);
+	assert(memcmp(console_buffer, "[    0.000000042,5] Hello World", strlen("[    0.000042,5] Hello World")) == 0);
 	assert(flushed_to_drivers==true);
 
 	return 0;
-- 
2.1.4



More information about the Skiboot mailing list