From: Andrew Murray <amur...@mpcdata.com>

This patch adds timings information to printfs.

Signed-off-by: Andrew Murray <amur...@theiet.org>
---
 common/console.c |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/common/console.c b/common/console.c
index 8c650e0..33de3fa 100644
--- a/common/console.c
+++ b/common/console.c
@@ -370,13 +370,23 @@ int printf(const char *fmt, ...)
        va_list args;
        uint i;
        char printbuffer[CONFIG_SYS_PBSIZE];
+       char *buf = printbuffer;
 
        va_start(args, fmt);
 
+#if defined(CONFIG_BOOT_TRACE)
+       unsigned long long ticks = get_ticks();
+       int secs = ticks / get_tbclk();
+       int msec = ((ticks * 1000000) / get_tbclk()) - (secs * 1000000);
+
+       i += sprintf(buf, "[%5lu.%06lu] ", secs, msec);
+       buf += i;
+#endif
+
        /* For this to work, printbuffer must be larger than
         * anything we ever want to print.
         */
-       i = vsprintf(printbuffer, fmt, args);
+       i += vsprintf(buf, fmt, args);
        va_end(args);
 
        /* Print the string */
-- 
1.7.4.1

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to