summaryrefslogtreecommitdiff
path: root/trace2.h
diff options
context:
space:
mode:
authorJeff Hostetler <jeffhost@microsoft.com>2019-04-15 13:39:43 -0700
committerJunio C Hamano <gitster@pobox.com>2019-04-16 13:37:06 +0900
commita089724958a99924d9ec7ff60a6aea63d03448f2 (patch)
treef1064e35b8f752995f275c0c78fb642228d95857 /trace2.h
parent1703751f21d286b383c198157a1342c35ebc11b7 (diff)
downloadgit-a089724958a99924d9ec7ff60a6aea63d03448f2.tar.gz
trace2: refactor setting process starting time
Create trace2_initialize_clock() and call from main() to capture process start time in isolation and before other sub-systems are ready. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trace2.h')
-rw-r--r--trace2.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/trace2.h b/trace2.h
index ae5020d0e6..8f89e70c44 100644
--- a/trace2.h
+++ b/trace2.h
@@ -20,6 +20,23 @@ 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.
*