From: "Jeff Hostetler via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Jeff Hostetler <jeffhost@microsoft.com>
Subject: [PATCH v3 7/7] trace2: cleanup whitespace in perf format
Date: Fri, 09 Aug 2019 08:00:57 -0700 (PDT) [thread overview]
Message-ID: <9ab73939855f78563b1554282920aa11ff958f4e.1565362851.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.298.v3.git.gitgitgadget@gmail.com>
From: Jeff Hostetler <jeffhost@microsoft.com>
Make use of new sq_append_quote_argv_pretty() to normalize
how we handle leading whitespace in perf format messages.
Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
---
t/t0211-trace2-perf.sh | 4 ++--
trace2/tr2_tgt_perf.c | 31 ++++++++++++++++++++-----------
2 files changed, 22 insertions(+), 13 deletions(-)
diff --git a/t/t0211-trace2-perf.sh b/t/t0211-trace2-perf.sh
index 2c3ad6e8c1..6ee8ee3b67 100755
--- a/t/t0211-trace2-perf.sh
+++ b/t/t0211-trace2-perf.sh
@@ -130,11 +130,11 @@ test_expect_success 'perf stream, child processes' '
d0|main|version|||||$V
d0|main|start||_T_ABS_|||_EXE_ trace2 004child test-tool trace2 004child test-tool trace2 001return 0
d0|main|cmd_name|||||trace2 (trace2)
- d0|main|child_start||_T_ABS_|||[ch0] class:? argv: test-tool trace2 004child test-tool trace2 001return 0
+ d0|main|child_start||_T_ABS_|||[ch0] class:? argv:[test-tool trace2 004child test-tool trace2 001return 0]
d1|main|version|||||$V
d1|main|start||_T_ABS_|||_EXE_ trace2 004child test-tool trace2 001return 0
d1|main|cmd_name|||||trace2 (trace2/trace2)
- d1|main|child_start||_T_ABS_|||[ch0] class:? argv: test-tool trace2 001return 0
+ d1|main|child_start||_T_ABS_|||[ch0] class:? argv:[test-tool trace2 001return 0]
d2|main|version|||||$V
d2|main|start||_T_ABS_|||_EXE_ trace2 001return 0
d2|main|cmd_name|||||trace2 (trace2/trace2/trace2)
diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c
index 8e52395de2..fd979db4ad 100644
--- a/trace2/tr2_tgt_perf.c
+++ b/trace2/tr2_tgt_perf.c
@@ -184,7 +184,7 @@ static void fn_start_fl(const char *file, int line,
const char *event_name = "start";
struct strbuf buf_payload = STRBUF_INIT;
- sq_quote_argv_pretty(&buf_payload, argv);
+ sq_append_quote_argv_pretty(&buf_payload, argv);
perf_io_write_fl(file, line, event_name, NULL, &us_elapsed_absolute,
NULL, NULL, &buf_payload);
@@ -299,8 +299,9 @@ static void fn_alias_fl(const char *file, int line, const char *alias,
const char *event_name = "alias";
struct strbuf buf_payload = STRBUF_INIT;
- strbuf_addf(&buf_payload, "alias:%s argv:", alias);
- sq_quote_argv_pretty(&buf_payload, argv);
+ strbuf_addf(&buf_payload, "alias:%s argv:[", alias);
+ sq_append_quote_argv_pretty(&buf_payload, argv);
+ strbuf_addch(&buf_payload, ']');
perf_io_write_fl(file, line, event_name, NULL, NULL, NULL, NULL,
&buf_payload);
@@ -329,10 +330,14 @@ static void fn_child_start_fl(const char *file, int line,
sq_quote_buf_pretty(&buf_payload, cmd->dir);
}
- strbuf_addstr(&buf_payload, " argv:");
- if (cmd->git_cmd)
- strbuf_addstr(&buf_payload, " git");
- sq_quote_argv_pretty(&buf_payload, cmd->argv);
+ strbuf_addstr(&buf_payload, " argv:[");
+ if (cmd->git_cmd) {
+ strbuf_addstr(&buf_payload, "git");
+ if (cmd->argv[0])
+ strbuf_addch(&buf_payload, ' ');
+ }
+ sq_append_quote_argv_pretty(&buf_payload, cmd->argv);
+ strbuf_addch(&buf_payload, ']');
perf_io_write_fl(file, line, event_name, NULL, &us_elapsed_absolute,
NULL, NULL, &buf_payload);
@@ -383,10 +388,14 @@ static void fn_exec_fl(const char *file, int line, uint64_t us_elapsed_absolute,
struct strbuf buf_payload = STRBUF_INIT;
strbuf_addf(&buf_payload, "id:%d ", exec_id);
- strbuf_addstr(&buf_payload, "argv:");
- if (exe)
- strbuf_addf(&buf_payload, " %s", exe);
- sq_quote_argv_pretty(&buf_payload, argv);
+ strbuf_addstr(&buf_payload, "argv:[");
+ if (exe) {
+ strbuf_addstr(&buf_payload, exe);
+ if (argv[0])
+ strbuf_addch(&buf_payload, ' ');
+ }
+ sq_append_quote_argv_pretty(&buf_payload, argv);
+ strbuf_addch(&buf_payload, ']');
perf_io_write_fl(file, line, event_name, NULL, &us_elapsed_absolute,
NULL, NULL, &buf_payload);
--
gitgitgadget
next prev parent reply other threads:[~2019-08-09 15:01 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-31 20:04 [PATCH 0/3] trace2: clean up formatting in perf target format Jeff Hostetler via GitGitGadget
2019-07-31 20:04 ` [PATCH 1/3] trace2: cleanup column alignment " Jeff Hostetler via GitGitGadget
2019-07-31 20:04 ` [PATCH 2/3] trace2: trim whitespace in start message " Jeff Hostetler via GitGitGadget
2019-08-01 21:34 ` Junio C Hamano
2019-08-07 20:25 ` Jeff Hostetler
2019-08-07 20:37 ` Junio C Hamano
2019-07-31 20:04 ` [PATCH 3/3] trace2: trim whitespace in region messages " Jeff Hostetler via GitGitGadget
2019-08-01 22:57 ` [PATCH 0/3] trace2: clean up formatting " Josh Steadmon
2019-08-08 14:18 ` [PATCH v2 0/7] " Jeff Hostetler via GitGitGadget
2019-08-08 14:18 ` [PATCH v2 1/7] trace2: cleanup column alignment " Jeff Hostetler via GitGitGadget
2019-08-08 14:19 ` [PATCH v2 2/7] trace2: trim whitespace in region messages " Jeff Hostetler via GitGitGadget
2019-08-08 14:19 ` [PATCH v2 3/7] trace2: remove dead code in maybe_add_string_va() Jeff Hostetler via GitGitGadget
2019-08-08 14:19 ` [PATCH v2 5/7] quote: add sq_quote_argv_pretty_ltrim Jeff Hostetler via GitGitGadget
2019-08-08 18:05 ` Junio C Hamano
2019-08-08 19:04 ` Jeff Hostetler
2019-08-08 20:01 ` Junio C Hamano
2019-08-08 22:49 ` René Scharfe
2019-08-09 17:13 ` Jeff Hostetler
2019-08-09 18:01 ` René Scharfe
2019-08-08 14:19 ` [PATCH v2 4/7] trace2: trim trailing whitespace in normal format error message Jeff Hostetler via GitGitGadget
2019-08-08 14:19 ` [PATCH v2 6/7] trace2: cleanup whitespace in normal format Jeff Hostetler via GitGitGadget
2019-08-08 14:19 ` [PATCH v2 7/7] trace2: cleanup whitespace in perf format Jeff Hostetler via GitGitGadget
2019-08-09 15:00 ` [PATCH v3 0/7] trace2: clean up formatting in perf target format Jeff Hostetler via GitGitGadget
2019-08-09 15:00 ` [PATCH v3 1/7] trace2: cleanup column alignment " Jeff Hostetler via GitGitGadget
2019-08-09 15:00 ` [PATCH v3 2/7] trace2: trim whitespace in region messages " Jeff Hostetler via GitGitGadget
2019-08-09 15:00 ` [PATCH v3 3/7] trace2: remove dead code in maybe_add_string_va() Jeff Hostetler via GitGitGadget
2019-08-09 15:00 ` [PATCH v3 4/7] trace2: trim trailing whitespace in normal format error message Jeff Hostetler via GitGitGadget
2019-08-09 15:00 ` [PATCH v3 5/7] quote: add sq_append_quote_argv_pretty() Jeff Hostetler via GitGitGadget
2019-08-09 17:54 ` Junio C Hamano
2019-08-09 18:17 ` Jeff Hostetler
2019-08-09 15:00 ` [PATCH v3 6/7] trace2: cleanup whitespace in normal format Jeff Hostetler via GitGitGadget
2019-08-09 15:00 ` Jeff Hostetler via GitGitGadget [this message]
2019-08-09 18:14 ` [PATCH v3 0/7] trace2: clean up formatting in perf target format Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9ab73939855f78563b1554282920aa11ff958f4e.1565362851.git.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).