Commit 0a35c4b3 authored by Colin Percival's avatar Colin Percival
Browse files

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
parent 242923eb
...@@ -271,6 +271,7 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) ...@@ -271,6 +271,7 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap)
char padc; char padc;
int stop = 0, retval = 0; int stop = 0, retval = 0;
TSENTER();
num = 0; num = 0;
if (!func) if (!func)
d = (char *) arg; d = (char *) arg;
...@@ -287,8 +288,10 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap) ...@@ -287,8 +288,10 @@ kvprintf(char const *fmt, kvprintf_fn_t *func, void *arg, int radix, va_list ap)
padc = ' '; padc = ' ';
width = 0; width = 0;
while ((ch = (u_char)*fmt++) != '%' || stop) { while ((ch = (u_char)*fmt++) != '%' || stop) {
if (ch == '\0') if (ch == '\0') {
TSEXIT();
return (retval); return (retval);
}
PCHAR(ch); PCHAR(ch);
} }
percent = fmt - 1; percent = fmt - 1;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment