summaryrefslogtreecommitdiff
path: root/trace2
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2019-08-08 14:19:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-08-08 17:39:44 (GMT)
commitda4589ce7ecb84b51b2819542f9555848dccf726 (patch)
treedce40b1b112e71c3c7ca2d3de866f11bd3e32f07 /trace2
parent371df1bea994d14347c3bea7a67066056d86b093 (diff)
downloadgit-da4589ce7ecb84b51b2819542f9555848dccf726.zip
git-da4589ce7ecb84b51b2819542f9555848dccf726.tar.gz
git-da4589ce7ecb84b51b2819542f9555848dccf726.tar.bz2
trace2: trim whitespace in region messages in perf target format
Avoid unecessary trailing whitespace in "region_enter" and "region_leave" messages in perf target format. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trace2')
-rw-r--r--trace2/tr2_tgt_perf.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c
index 4a9d992..fb845cb 100644
--- a/trace2/tr2_tgt_perf.c
+++ b/trace2/tr2_tgt_perf.c
@@ -452,8 +452,11 @@ static void fn_region_enter_printf_va_fl(const char *file, int line,
struct strbuf buf_payload = STRBUF_INIT;
if (label)
- strbuf_addf(&buf_payload, "label:%s ", label);
- maybe_append_string_va(&buf_payload, fmt, ap);
+ strbuf_addf(&buf_payload, "label:%s", label);
+ if (fmt && *fmt) {
+ strbuf_addch(&buf_payload, ' ');
+ maybe_append_string_va(&buf_payload, fmt, ap);
+ }
perf_io_write_fl(file, line, event_name, repo, &us_elapsed_absolute,
NULL, category, &buf_payload);
@@ -469,8 +472,11 @@ static void fn_region_leave_printf_va_fl(
struct strbuf buf_payload = STRBUF_INIT;
if (label)
- strbuf_addf(&buf_payload, "label:%s ", label);
- maybe_append_string_va(&buf_payload, fmt, ap);
+ strbuf_addf(&buf_payload, "label:%s", label);
+ if (fmt && *fmt) {
+ strbuf_addch(&buf_payload, ' ' );
+ maybe_append_string_va(&buf_payload, fmt, ap);
+ }
perf_io_write_fl(file, line, event_name, repo, &us_elapsed_absolute,
&us_elapsed_region, category, &buf_payload);