Merge branch 'ns/trace2-fsync-stat'
Trace2 code has been taught to report stats for fsync operations. * ns/trace2-fsync-stat: trace2: add stats for fsync operations
This commit is contained in:
commit
fe496dc5b9
@ -1281,6 +1281,11 @@ enum fsync_action {
|
|||||||
*/
|
*/
|
||||||
int git_fsync(int fd, enum fsync_action action);
|
int git_fsync(int fd, enum fsync_action action);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Writes out trace statistics for fsync using the trace2 API.
|
||||||
|
*/
|
||||||
|
void trace_git_fsync_stats(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Preserves errno, prints a message, but gives no warning for ENOENT.
|
* Preserves errno, prints a message, but gives no warning for ENOENT.
|
||||||
* Returns 0 on success, which includes trying to unlink an object that does
|
* Returns 0 on success, which includes trying to unlink an object that does
|
||||||
|
@ -59,6 +59,10 @@ while (<>) {
|
|||||||
# and highly variable. Just omit them.
|
# and highly variable. Just omit them.
|
||||||
goto SKIP_LINE;
|
goto SKIP_LINE;
|
||||||
}
|
}
|
||||||
|
if ($tokens[$col_category] =~ m/fsync/) {
|
||||||
|
# fsync events aren't interesting for the test
|
||||||
|
goto SKIP_LINE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# t_abs and t_rel are either blank or a float. Replace the float
|
# t_abs and t_rel are either blank or a float. Replace the float
|
||||||
|
1
trace2.c
1
trace2.c
@ -214,6 +214,7 @@ int trace2_cmd_exit_fl(const char *file, int line, int code)
|
|||||||
if (!trace2_enabled)
|
if (!trace2_enabled)
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
|
trace_git_fsync_stats();
|
||||||
trace2_collect_process_info(TRACE2_PROCESS_INFO_EXIT);
|
trace2_collect_process_info(TRACE2_PROCESS_INFO_EXIT);
|
||||||
|
|
||||||
tr2main_exit_code = code;
|
tr2main_exit_code = code;
|
||||||
|
12
wrapper.c
12
wrapper.c
@ -4,6 +4,9 @@
|
|||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
static intmax_t count_fsync_writeout_only;
|
||||||
|
static intmax_t count_fsync_hardware_flush;
|
||||||
|
|
||||||
#ifdef HAVE_RTLGENRANDOM
|
#ifdef HAVE_RTLGENRANDOM
|
||||||
/* This is required to get access to RtlGenRandom. */
|
/* This is required to get access to RtlGenRandom. */
|
||||||
#define SystemFunction036 NTAPI SystemFunction036
|
#define SystemFunction036 NTAPI SystemFunction036
|
||||||
@ -564,6 +567,7 @@ int git_fsync(int fd, enum fsync_action action)
|
|||||||
{
|
{
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case FSYNC_WRITEOUT_ONLY:
|
case FSYNC_WRITEOUT_ONLY:
|
||||||
|
count_fsync_writeout_only += 1;
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
/*
|
/*
|
||||||
@ -595,6 +599,8 @@ int git_fsync(int fd, enum fsync_action action)
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case FSYNC_HARDWARE_FLUSH:
|
case FSYNC_HARDWARE_FLUSH:
|
||||||
|
count_fsync_hardware_flush += 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* On macOS, a special fcntl is required to really flush the
|
* On macOS, a special fcntl is required to really flush the
|
||||||
* caches within the storage controller. As of this writing,
|
* caches within the storage controller. As of this writing,
|
||||||
@ -610,6 +616,12 @@ int git_fsync(int fd, enum fsync_action action)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void trace_git_fsync_stats(void)
|
||||||
|
{
|
||||||
|
trace2_data_intmax("fsync", the_repository, "fsync/writeout-only", count_fsync_writeout_only);
|
||||||
|
trace2_data_intmax("fsync", the_repository, "fsync/hardware-flush", count_fsync_hardware_flush);
|
||||||
|
}
|
||||||
|
|
||||||
static int warn_if_unremovable(const char *op, const char *file, int rc)
|
static int warn_if_unremovable(const char *op, const char *file, int rc)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
Loading…
Reference in New Issue
Block a user