From: Gerhard Sittig Date: Fri, 18 Sep 2020 14:38:54 +0000 (+0200) Subject: serial-dmm: only do bytes to text conversion at higher log levels X-Git-Url: https://sigrok.org/gitweb/?a=commitdiff_plain;h=abcb13855f5dfdd34bdae5da0586b37c7d2d8731;p=libsigrok.git serial-dmm: only do bytes to text conversion at higher log levels Check the current log level before starting the potentially expensive bytes to text conversion for a debug message (dump DMM packets). --- diff --git a/src/hardware/serial-dmm/protocol.c b/src/hardware/serial-dmm/protocol.c index 5e8912bf..71fc1a46 100644 --- a/src/hardware/serial-dmm/protocol.c +++ b/src/hardware/serial-dmm/protocol.c @@ -31,6 +31,9 @@ static void log_dmm_packet(const uint8_t *buf, size_t len) { GString *text; + if (sr_log_loglevel_get() < SR_LOG_DBG) + return; + text = sr_hexdump_new(buf, len); sr_dbg("DMM packet: %s", text->str); sr_hexdump_free(text);