Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Sep 2021 03:23:56 GMT
From:      Colin Percival <cperciva@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 0a35c4b3cab5 - main - loader printf: Profile with TSLOG
Message-ID:  <202109250323.18P3NuNA096431@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by cperciva:

URL: https://cgit.FreeBSD.org/src/commit/?id=0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04

commit 0a35c4b3cab563e3ab1bf5b7b49bf26e0bb7cb04
Author:     Colin Percival <cperciva@FreeBSD.org>
AuthorDate: 2021-09-25 03:20:33 +0000
Commit:     Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2021-09-25 03:23:49 +0000

    loader printf: Profile with TSLOG
    
    Now that the loader tslog code doesn't call printf, we can profile
    printf using TSLOG.  On an EC2 c5.xlarge instance, we spend roughly
    45 ms here (out of roughly 500 ms), presumably due to the time spent
    writing output to the console.
    
    MFC after:      1 week
    Sponsored by:   https://www.patreon.com/cperciva
---
 stand/libsa/printf.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/stand/libsa/printf.c b/stand/libsa/printf.c
index 1602a2dc519d..4de547b644dd 100644
--- a/stand/libsa/printf.c
+++ b/stand/libsa/printf.c
@@ -271,6 +271,7 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap)
 	char padc;
 	int stop = 0, retval = 0;
 
+	TSENTER();
 	num = 0;
 	if (!func)
 		d = (char *) arg;
@@ -287,8 +288,10 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap)
 		padc = ' ';
 		width = 0;
 		while ((ch = (u_char)*fmt++) != '%' || stop) {
-			if (ch == '\0')
+			if (ch == '\0') {
+				TSEXIT();
 				return (retval);
+			}
 			PCHAR(ch);
 		}
 		percent = fmt - 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202109250323.18P3NuNA096431>