Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-05-13 17:50:31 +0300
committerJunio C Hamano <gitster@pobox.com>2019-05-13 17:50:31 +0300
commit5b2d1c0c6eceb5fd6c9527bc2863179644dce840 (patch)
tree157db719b486e9bdd971efc9aa15fca4e77a3681 /trace2.h
parent6a6c0f10a70a6eb101c213b09ae82a9cad252743 (diff)
parentf672deec2d56b0d7ae64ce3efd918e02efc58b9c (diff)
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.h')
-rw-r--r--trace2.h43
1 files changed, 34 insertions, 9 deletions
diff --git a/trace2.h b/trace2.h
index b330a54a89..f189ef5984 100644
--- a/trace2.h
+++ b/trace2.h
@@ -20,8 +20,26 @@ struct json_writer;
*/
/*
+ * Initialize the TRACE2 clock and do nothing else, in particular
+ * no mallocs, no system inspection, and no environment inspection.
+ *
+ * This should be called at the very top of main() to capture the
+ * process start time. This is intended to reduce chicken-n-egg
+ * bootstrap pressure.
+ *
+ * It is safe to call this more than once. This allows capturing
+ * absolute startup costs on Windows which uses a little trickery
+ * to do setup work before common-main.c:main() is called.
+ *
+ * The main trace2_initialize_fl() may be called a little later
+ * after more infrastructure is established.
+ */
+void trace2_initialize_clock(void);
+
+/*
* Initialize TRACE2 tracing facility if any of the builtin TRACE2
- * targets are enabled in the environment. Emits a 'version' event.
+ * targets are enabled in the system config or the environment.
+ * Emits a 'version' event.
*
* Cleanup/Termination is handled automatically by a registered
* atexit() routine.
@@ -108,10 +126,11 @@ void trace2_cmd_alias_fl(const char *file, int line, const char *alias,
* Emit one or more 'def_param' events for "interesting" configuration
* settings.
*
- * The environment variable "GIT_TR2_CONFIG_PARAMS" can be set to a
- * list of patterns considered important. For example:
- *
- * GIT_TR2_CONFIG_PARAMS="core.*,remote.*.url"
+ * Use the TR2_SYSENV_CFG_PARAM setting to register a comma-separated
+ * list of patterns configured important. For example:
+ * git config --system trace2.configParams 'core.*,remote.*.url'
+ * or:
+ * GIT_TR2_CONFIG_PARAMS=core.*,remote.*.url"
*
* Note: this routine does a read-only iteration on the config data
* (using read_early_config()), so it must not be called until enough
@@ -372,13 +391,19 @@ void trace2_printf(const char *fmt, ...);
* Optional platform-specific code to dump information about the
* current and any parent process(es). This is intended to allow
* post-processors to know who spawned this git instance and anything
- * else the platform may be able to tell us about the current process.
+ * else that the platform may be able to tell us about the current process.
*/
+
+enum trace2_process_info_reason {
+ TRACE2_PROCESS_INFO_STARTUP,
+ TRACE2_PROCESS_INFO_EXIT,
+};
+
#if defined(GIT_WINDOWS_NATIVE)
-void trace2_collect_process_info(void);
+void trace2_collect_process_info(enum trace2_process_info_reason reason);
#else
-#define trace2_collect_process_info() \
- do { \
+#define trace2_collect_process_info(reason) \
+ do { \
} while (0)
#endif