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:
authorJeff Hostetler <jeffhost@microsoft.com>2021-02-03 18:34:44 +0300
committerJunio C Hamano <gitster@pobox.com>2021-02-17 04:14:34 +0300
commit8c4b7503d033d8ba20771a1af8e077a79a18ce49 (patch)
tree84e5f338880cc5ba3cb4d816d1bb7b0333f03561 /preload-index.c
parent4f2009dce2d270ded8bb94417becf6cc2143c70c (diff)
preload-index: log the number of lstat calls to trace2
Report the total number of calls made to lstat() inside preload_index(). FSMonitor improves the performance of commands like `git status` by avoiding scanning the disk for changed files. This can be seen in `preload_index()`. Let's measure this. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Reviewed-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'preload-index.c')
-rw-r--r--preload-index.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/preload-index.c b/preload-index.c
index ed6eaa4738..e5529a5863 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -31,6 +31,7 @@ struct thread_data {
struct pathspec pathspec;
struct progress_data *progress;
int offset, nr;
+ int t2_nr_lstat;
};
static void *preload_thread(void *_data)
@@ -73,6 +74,7 @@ static void *preload_thread(void *_data)
continue;
if (threaded_has_symlink_leading_path(&cache, ce->name, ce_namelen(ce)))
continue;
+ p->t2_nr_lstat++;
if (lstat(ce->name, &st))
continue;
if (ie_match_stat(index, ce, &st, CE_MATCH_RACY_IS_DIRTY|CE_MATCH_IGNORE_FSMONITOR))
@@ -98,6 +100,7 @@ void preload_index(struct index_state *index,
int threads, i, work, offset;
struct thread_data data[MAX_PARALLEL];
struct progress_data pd;
+ int t2_sum_lstat = 0;
if (!HAVE_THREADS || !core_preload_index)
return;
@@ -107,6 +110,9 @@ void preload_index(struct index_state *index,
threads = 2;
if (threads < 2)
return;
+
+ trace2_region_enter("index", "preload", NULL);
+
trace_performance_enter();
if (threads > MAX_PARALLEL)
threads = MAX_PARALLEL;
@@ -141,10 +147,14 @@ void preload_index(struct index_state *index,
struct thread_data *p = data+i;
if (pthread_join(p->pthread, NULL))
die("unable to join threaded lstat");
+ t2_sum_lstat += p->t2_nr_lstat;
}
stop_progress(&pd.progress);
trace_performance_leave("preload index");
+
+ trace2_data_intmax("index", NULL, "preload/sum_lstat", t2_sum_lstat);
+ trace2_region_leave("index", "preload", NULL);
}
int repo_read_index_preload(struct repository *repo,