summaryrefslogtreecommitdiff
path: root/dir.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-01-27 12:27:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-02-02 19:20:16 (GMT)
commitca54d9baa4a8e73141d4c963245ee6f09dcc994d (patch)
treed0418cefb4c51789cc338eed93c7b0933644d012 /dir.c
parent5be1f00a9a701532232f57958efab4be8c959a29 (diff)
downloadgit-ca54d9baa4a8e73141d4c963245ee6f09dcc994d.zip
git-ca54d9baa4a8e73141d4c963245ee6f09dcc994d.tar.gz
git-ca54d9baa4a8e73141d4c963245ee6f09dcc994d.tar.bz2
trace: measure where the time is spent in the index-heavy operations
All the known heavy code blocks are measured (except object database access). This should help identify if an optimization is effective or not. An unoptimized git-status would give something like below: 0.001791141 s: read cache ... 0.004011363 s: preload index 0.000516161 s: refresh index 0.003139257 s: git command: ... 'status' '--porcelain=2' 0.006788129 s: diff-files 0.002090267 s: diff-index 0.001885735 s: initialize name hash 0.032013138 s: read directory 0.051781209 s: git command: './git' 'status' Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'dir.c')
-rw-r--r--dir.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/dir.c b/dir.c
index 7c4b45e..4479a02 100644
--- a/dir.c
+++ b/dir.c
@@ -2248,6 +2248,7 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
const char *path, int len, const struct pathspec *pathspec)
{
struct untracked_cache_dir *untracked;
+ uint64_t start = getnanotime();
if (has_symlink_leading_path(path, len))
return dir->nr;
@@ -2286,6 +2287,7 @@ int read_directory(struct dir_struct *dir, struct index_state *istate,
dir->nr = i;
}
+ trace_performance_since(start, "read directory %.*s", len, path);
if (dir->untracked) {
static struct trace_key trace_untracked_stats = TRACE_KEY_INIT(UNTRACKED_STATS);
trace_printf_key(&trace_untracked_stats,