commit | 5db8d6aafa66cbeaef6bf736ff5ad5b711069d9e | [log] [tgz] |
---|---|---|
author | Nick Kralevich <nnk@google.com> | Sat Jan 16 16:19:17 2016 -0800 |
committer | Nick Kralevich <nnk@google.com> | Sat Jan 16 16:20:24 2016 -0800 |
tree | 57d11396532104441eafe371b09100a973e2ea8b | |
parent | 13655cdc77a361b8780297b6d7778659cf39d858 [diff] [blame] |
logging: avoid unnecessary printfs Don't spend CPU cycles formatting a bunch of strings if we're just going to throw them away later. Maybe make booting faster. Change-Id: I4d8eb99fb3fa873ca91cf776933d0ad01988abf5
diff --git a/libcutils/klog.c b/libcutils/klog.c index 710dc66..7402903 100644 --- a/libcutils/klog.c +++ b/libcutils/klog.c
@@ -62,6 +62,7 @@ } void klog_write(int level, const char* fmt, ...) { + if (level > klog_level) return; char buf[LOG_BUF_MAX]; va_list ap; va_start(ap, fmt);