#define USE_THE_REPOSITORY_VARIABLE
#include "git-compat-util.h"
#include "abspath.h"
#include "repository.h"
#include "quote.h"
#include "setup.h"
#include "trace.h"
struct trace_key trace_default_key = …;
struct trace_key trace_perf_key = …;
struct trace_key trace_setup_key = …;
static int get_trace_fd(struct trace_key *key, const char *override_envvar)
{ … }
void trace_override_envvar(struct trace_key *key, const char *value)
{ … }
void trace_disable(struct trace_key *key)
{ … }
static int prepare_trace_line(const char *file, int line,
struct trace_key *key, struct strbuf *buf)
{ … }
static void trace_write(struct trace_key *key, const void *buf, unsigned len)
{ … }
void trace_verbatim(struct trace_key *key, const void *buf, unsigned len)
{ … }
static void print_trace_line(struct trace_key *key, struct strbuf *buf)
{ … }
static void trace_vprintf_fl(const char *file, int line, struct trace_key *key,
const char *format, va_list ap)
{ … }
static void trace_argv_vprintf_fl(const char *file, int line,
const char **argv, const char *format,
va_list ap)
{ … }
void trace_strbuf_fl(const char *file, int line, struct trace_key *key,
const struct strbuf *data)
{ … }
static uint64_t perf_start_times[10];
static int perf_indent;
uint64_t trace_performance_enter(void)
{ … }
static void trace_performance_vprintf_fl(const char *file, int line,
uint64_t nanos, const char *format,
va_list ap)
{ … }
void trace_printf_key_fl(const char *file, int line, struct trace_key *key,
const char *format, ...)
{ … }
void trace_argv_printf_fl(const char *file, int line, const char **argv,
const char *format, ...)
{ … }
void trace_performance_fl(const char *file, int line, uint64_t nanos,
const char *format, ...)
{ … }
void trace_performance_leave_fl(const char *file, int line,
uint64_t nanos, const char *format, ...)
{ … }
static const char *quote_crnl(const char *path)
{ … }
void trace_repo_setup(void)
{ … }
int trace_want(struct trace_key *key)
{ … }
#if defined(HAVE_CLOCK_GETTIME) && defined(HAVE_CLOCK_MONOTONIC)
static inline uint64_t highres_nanos(void)
{ … }
#elif defined (GIT_WINDOWS_NATIVE)
static inline uint64_t highres_nanos(void)
{
static uint64_t high_ns, scaled_low_ns;
static int scale;
LARGE_INTEGER cnt;
if (!scale) {
if (!QueryPerformanceFrequency(&cnt))
return 0;
high_ns = (1000000000LL << 32) / (uint64_t) cnt.QuadPart;
scaled_low_ns = high_ns;
scale = 32;
while (scaled_low_ns >= 0x100000000LL) {
scaled_low_ns >>= 1;
scale--;
}
}
QueryPerformanceCounter(&cnt);
return (high_ns * cnt.HighPart) +
((scaled_low_ns * cnt.LowPart) >> scale);
}
#else
#define highres_nanos …
#endif
static inline uint64_t gettimeofday_nanos(void)
{ … }
uint64_t getnanotime(void)
{ … }
static struct strbuf command_line = …;
static void print_command_performance_atexit(void)
{ … }
void trace_command_performance(const char **argv)
{ … }