1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-07 16:36:13 +02:00
git/trace2/tr2_dst.h
Jeff Hostetler bce9db6de9 trace2: use system/global config for default trace2 settings
Teach git to read the system and global config files for
default Trace2 settings.  This allows system-wide Trace2 settings to
be installed and inherited to make it easier to manage a collection of
systems.

The original GIT_TR2* environment variables are loaded afterwards and
can be used to override the system settings.

Only the system and global config files are used.  Repo and worktree
local config files are ignored.  Likewise, the "-c" command line
arguments are also ignored.  These limits are for performance reasons.

(1) For users not using Trace2, there should be minimal overhead to
detect that Trace2 is not enabled.  In particular, Trace2 should not
allocate lots of otherwise unused data strucutres.

(2) For accurate performance measurements, Trace2 should be initialized
as early in the git process as possible, and before most of the normal
git process initialization (which involves discovering the .git directory
and reading a hierarchy of config files).

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2019-04-16 13:37:06 +09:00

38 lines
823 B
C

#ifndef TR2_DST_H
#define TR2_DST_H
struct strbuf;
#include "trace2/tr2_sysenv.h"
struct tr2_dst {
enum tr2_sysenv_variable sysenv_var;
int fd;
unsigned int initialized : 1;
unsigned int need_close : 1;
};
/*
* Disable TRACE2 on the destination. In TRACE2 a destination (DST)
* wraps a file descriptor; it is associated with a TARGET which
* defines the formatting.
*/
void tr2_dst_trace_disable(struct tr2_dst *dst);
/*
* Return the file descriptor for the DST.
* If 0, the dst is closed or disabled.
*/
int tr2_dst_get_trace_fd(struct tr2_dst *dst);
/*
* Return true if the DST is opened for writing.
*/
int tr2_dst_trace_want(struct tr2_dst *dst);
/*
* Write a single line/message to the trace file.
*/
void tr2_dst_write_line(struct tr2_dst *dst, struct strbuf *buf_line);
#endif /* TR2_DST_H */