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:
authorGennady Kupava <gkupava@bloomberg.net>2017-11-26 23:11:19 +0300
committerJunio C Hamano <gitster@pobox.com>2017-12-06 20:43:02 +0300
commit8eeb25c6795af71400537e8ab064407d7998e0e2 (patch)
tree6770696f980fedd713b8235ea3d96a868663f8fa /trace.c
parent406102a731145d39c497e384857ac9f9d2bdccb2 (diff)
trace: improve performance while category is disabled
Move just enough code from trace.c into trace.h header so all code necessary to determine that trace is disabled could be inlined to calling functions. Then perform the check if the trace key is enabled sooner in call chain. Signed-off-by: Gennady Kupava <gkupava@bloomberg.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trace.c')
-rw-r--r--trace.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/trace.c b/trace.c
index d47ea28e88..b7530b51a9 100644
--- a/trace.c
+++ b/trace.c
@@ -25,6 +25,7 @@
#include "quote.h"
struct trace_key trace_default_key = { "GIT_TRACE", 0, 0, 0 };
+struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);
/* Get a trace file descriptor from "key" env variable. */
static int get_trace_fd(struct trace_key *key)
@@ -172,8 +173,6 @@ void trace_strbuf_fl(const char *file, int line, struct trace_key *key,
print_trace_line(key, &buf);
}
-static struct trace_key trace_perf_key = TRACE_KEY_INIT(PERFORMANCE);
-
static void trace_performance_vprintf_fl(const char *file, int line,
uint64_t nanos, const char *format,
va_list ap)