From 242ed509c52cafd91c445a4b6c97e91f48172b3b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 17 Jun 2019 17:56:02 -0400 Subject: [PATCH] sink.text.pretty: don't use printf for binary values printf is slow compared to simply appending '1' or '0' characters to the GString. Signed-off-by: Mathieu Desnoyers Change-Id: I2605c1e6d2dc463be237e8eb00f70a84e4c5fd1a Reviewed-on: https://review.lttng.org/c/babeltrace/+/1507 CI-Build: Philippe Proulx Tested-by: jenkins Reviewed-by: Philippe Proulx Reviewed-by: Francis Deslauriers --- src/plugins/text/pretty/print.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/text/pretty/print.c b/src/plugins/text/pretty/print.c index 8474c43c..5c18a07d 100644 --- a/src/plugins/text/pretty/print.c +++ b/src/plugins/text/pretty/print.c @@ -552,7 +552,8 @@ int print_integer(struct pretty_component *pretty, bt_common_g_string_append(pretty->string, "0b"); _bt_safe_lshift(v.u, 64 - len); for (bitnr = 0; bitnr < len; bitnr++) { - bt_common_g_string_append_printf(pretty->string, "%u", (v.u & (1ULL << 63)) ? 1 : 0); + bt_common_g_string_append_c(pretty->string, + (v.u & (1ULL << 63)) ? '1' : '0'); _bt_safe_lshift(v.u, 1); } break; -- 2.34.1