summaryrefslogtreecommitdiff
path: root/trace2.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-13 14:50:31 (GMT)
committerJunio C Hamano <gitster@pobox.com>2019-05-13 14:50:31 (GMT)
commit5b2d1c0c6eceb5fd6c9527bc2863179644dce840 (patch)
tree157db719b486e9bdd971efc9aa15fca4e77a3681 /trace2.c
parent6a6c0f10a70a6eb101c213b09ae82a9cad252743 (diff)
parentf672deec2d56b0d7ae64ce3efd918e02efc58b9c (diff)
downloadgit-5b2d1c0c6eceb5fd6c9527bc2863179644dce840.zip
git-5b2d1c0c6eceb5fd6c9527bc2863179644dce840.tar.gz
git-5b2d1c0c6eceb5fd6c9527bc2863179644dce840.tar.bz2
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.c')
-rw-r--r--trace2.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/trace2.c b/trace2.c
index 8bbad56..eb759f3 100644
--- a/trace2.c
+++ b/trace2.c
@@ -10,6 +10,7 @@
#include "trace2/tr2_cmd_name.h"
#include "trace2/tr2_dst.h"
#include "trace2/tr2_sid.h"
+#include "trace2/tr2_sysenv.h"
#include "trace2/tr2_tgt.h"
#include "trace2/tr2_tls.h"
@@ -120,6 +121,7 @@ static void tr2main_atexit_handler(void)
tr2_sid_release();
tr2_cmd_name_release();
tr2_cfg_free_patterns();
+ tr2_sysenv_release();
trace2_enabled = 0;
}
@@ -142,6 +144,11 @@ static void tr2main_signal_handler(int signo)
raise(signo);
}
+void trace2_initialize_clock(void)
+{
+ tr2tls_start_process_clock();
+}
+
void trace2_initialize_fl(const char *file, int line)
{
struct tr2_tgt *tgt_j;
@@ -150,6 +157,8 @@ void trace2_initialize_fl(const char *file, int line)
if (trace2_enabled)
return;
+ tr2_sysenv_load();
+
if (!tr2_tgt_want_builtins())
return;
trace2_enabled = 1;
@@ -177,13 +186,19 @@ void trace2_cmd_start_fl(const char *file, int line, const char **argv)
{
struct tr2_tgt *tgt_j;
int j;
+ uint64_t us_now;
+ uint64_t us_elapsed_absolute;
if (!trace2_enabled)
return;
+ us_now = getnanotime() / 1000;
+ us_elapsed_absolute = tr2tls_absolute_elapsed(us_now);
+
for_each_wanted_builtin (j, tgt_j)
if (tgt_j->pfn_start_fl)
- tgt_j->pfn_start_fl(file, line, argv);
+ tgt_j->pfn_start_fl(file, line, us_elapsed_absolute,
+ argv);
}
int trace2_cmd_exit_fl(const char *file, int line, int code)
@@ -198,6 +213,8 @@ int trace2_cmd_exit_fl(const char *file, int line, int code)
if (!trace2_enabled)
return code;
+ trace2_collect_process_info(TRACE2_PROCESS_INFO_EXIT);
+
tr2main_exit_code = code;
us_now = getnanotime() / 1000;
@@ -428,7 +445,7 @@ void trace2_thread_start_fl(const char *file, int line, const char *thread_name)
us_now = getnanotime() / 1000;
us_elapsed_absolute = tr2tls_absolute_elapsed(us_now);
- tr2tls_create_self(thread_name);
+ tr2tls_create_self(thread_name, us_now);
for_each_wanted_builtin (j, tgt_j)
if (tgt_j->pfn_thread_start_fl)