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>2023-08-02 19:37:23 +0300
committerJunio C Hamano <gitster@pobox.com>2023-08-02 19:37:23 +0300
commit52d9dc20e1ddd5ac6b9e9113983b2f8d6977e6b0 (patch)
treee40cb3ecdc5a5620619c411e9b013718b9a300f4 /wrapper.c
parent99acb0fa54775a383cab70a6e662e45180dee3f0 (diff)
parenta27eecea75b3858b4052b191143f144a7e966869 (diff)
Merge branch 'bb/use-trace2-counters-for-fsync-stats'
Instead of inventing a custom counter variables for debugging, use existing trace2 facility in the fsync customization codepath. * bb/use-trace2-counters-for-fsync-stats: wrapper: use trace2 counters to collect fsync stats
Diffstat (limited to 'wrapper.c')
-rw-r--r--wrapper.c19
1 files changed, 2 insertions, 17 deletions
diff --git a/wrapper.c b/wrapper.c
index fb996f631a..5160c9e28d 100644
--- a/wrapper.c
+++ b/wrapper.c
@@ -10,9 +10,6 @@
#include "strbuf.h"
#include "trace2.h"
-static intmax_t count_fsync_writeout_only;
-static intmax_t count_fsync_hardware_flush;
-
#ifdef HAVE_RTLGENRANDOM
/* This is required to get access to RtlGenRandom. */
#define SystemFunction036 NTAPI SystemFunction036
@@ -551,7 +548,7 @@ int git_fsync(int fd, enum fsync_action action)
{
switch (action) {
case FSYNC_WRITEOUT_ONLY:
- count_fsync_writeout_only += 1;
+ trace2_counter_add(TRACE2_COUNTER_ID_FSYNC_WRITEOUT_ONLY, 1);
#ifdef __APPLE__
/*
@@ -583,7 +580,7 @@ int git_fsync(int fd, enum fsync_action action)
return -1;
case FSYNC_HARDWARE_FLUSH:
- count_fsync_hardware_flush += 1;
+ trace2_counter_add(TRACE2_COUNTER_ID_FSYNC_HARDWARE_FLUSH, 1);
/*
* On macOS, a special fcntl is required to really flush the
@@ -600,18 +597,6 @@ int git_fsync(int fd, enum fsync_action action)
}
}
-static void log_trace_fsync_if(const char *key, intmax_t value)
-{
- if (value)
- trace2_data_intmax("fsync", the_repository, key, value);
-}
-
-void trace_git_fsync_stats(void)
-{
- log_trace_fsync_if("fsync/writeout-only", count_fsync_writeout_only);
- log_trace_fsync_if("fsync/hardware-flush", count_fsync_hardware_flush);
-}
-
static int warn_if_unremovable(const char *op, const char *file, int rc)
{
int err;