diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-05-13 16:50:31 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-13 16:50:31 +0200 |
commit | 5b2d1c0c6eceb5fd6c9527bc2863179644dce840 (patch) | |
tree | 157db719b486e9bdd971efc9aa15fca4e77a3681 /trace2/tr2_tgt_perf.c | |
parent | The eighth batch (diff) | |
parent | trace2: fixup access problem on /etc/gitconfig in read_very_early_config (diff) | |
download | git-5b2d1c0c6eceb5fd6c9527bc2863179644dce840.tar.xz git-5b2d1c0c6eceb5fd6c9527bc2863179644dce840.zip |
Merge branch 'jh/trace2-sid-fix'
Polishing of the new trace2 facility continues. The system-level
configuration can specify site-wide trace2 settings, which can be
overridden with per-user configuration and environment variables.
* jh/trace2-sid-fix:
trace2: fixup access problem on /etc/gitconfig in read_very_early_config
trace2: update docs to describe system/global config settings
trace2: make SIDs more unique
trace2: clarify UTC datetime formatting
trace2: report peak memory usage of the process
trace2: use system/global config for default trace2 settings
config: add read_very_early_config()
trace2: find exec-dir before trace2 initialization
trace2: add absolute elapsed time to start event
trace2: refactor setting process starting time
config: initialize opts structure in repo_read_config()
Diffstat (limited to 'trace2/tr2_tgt_perf.c')
-rw-r--r-- | trace2/tr2_tgt_perf.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/trace2/tr2_tgt_perf.c b/trace2/tr2_tgt_perf.c index 2a866d701b..ea0cbbe13e 100644 --- a/trace2/tr2_tgt_perf.c +++ b/trace2/tr2_tgt_perf.c @@ -6,20 +6,20 @@ #include "json-writer.h" #include "trace2/tr2_dst.h" #include "trace2/tr2_sid.h" +#include "trace2/tr2_sysenv.h" #include "trace2/tr2_tbuf.h" #include "trace2/tr2_tgt.h" #include "trace2/tr2_tls.h" -static struct tr2_dst tr2dst_perf = { "GIT_TR2_PERF", 0, 0, 0 }; +static struct tr2_dst tr2dst_perf = { TR2_SYSENV_PERF, 0, 0, 0 }; /* - * Set this environment variable to true to omit the "<time> <file>:<line>" + * Use TR2_SYSENV_PERF_BRIEF to omit the "<time> <file>:<line>" * fields from each line written to the builtin performance target. * * Unit tests may want to use this to help with testing. */ -#define TR2_ENVVAR_PERF_BRIEF "GIT_TR2_PERF_BRIEF" -static int tr2env_perf_brief; +static int tr2env_perf_be_brief; #define TR2FMT_PERF_FL_WIDTH (50) #define TR2FMT_PERF_MAX_EVENT_NAME (12) @@ -36,17 +36,17 @@ static int fn_init(void) { int want = tr2_dst_trace_want(&tr2dst_perf); int want_brief; - char *brief; + const char *brief; if (!want) return want; strbuf_addchars(&dots, '.', TR2_DOTS_BUFFER_SIZE); - brief = getenv(TR2_ENVVAR_PERF_BRIEF); + brief = tr2_sysenv_get(TR2_SYSENV_PERF_BRIEF); if (brief && *brief && ((want_brief = git_parse_maybe_bool(brief)) != -1)) - tr2env_perf_brief = want_brief; + tr2env_perf_be_brief = want_brief; return want; } @@ -77,7 +77,7 @@ static void perf_fmt_prepare(const char *event_name, strbuf_setlen(buf, 0); - if (!tr2env_perf_brief) { + if (!tr2env_perf_be_brief) { struct tr2_tbuf tb_now; tr2_tbuf_local_time(&tb_now); @@ -159,15 +159,16 @@ static void fn_version_fl(const char *file, int line) strbuf_release(&buf_payload); } -static void fn_start_fl(const char *file, int line, const char **argv) +static void fn_start_fl(const char *file, int line, + uint64_t us_elapsed_absolute, const char **argv) { const char *event_name = "start"; struct strbuf buf_payload = STRBUF_INIT; sq_quote_argv_pretty(&buf_payload, argv); - perf_io_write_fl(file, line, event_name, NULL, NULL, NULL, NULL, - &buf_payload); + perf_io_write_fl(file, line, event_name, NULL, &us_elapsed_absolute, + NULL, NULL, &buf_payload); strbuf_release(&buf_payload); } |