diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-02-15 14:55:44 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-02-15 14:55:44 -0800 |
commit | 090dbea6843f860de8c981d97d031621176fc2be (patch) | |
tree | 228165692f17cde3632f94b9f26e1f26e3fab617 /read-cache.c | |
parent | Merge branch 'cc/perf-aggregate' (diff) | |
parent | trace: measure where the time is spent in the index-heavy operations (diff) | |
download | tgif-090dbea6843f860de8c981d97d031621176fc2be.tar.xz |
Merge branch 'nd/trace-index-ops'
* nd/trace-index-ops:
trace: measure where the time is spent in the index-heavy operations
Diffstat (limited to 'read-cache.c')
-rw-r--r-- | read-cache.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c index f9871cde33..82ba2287e1 100644 --- a/read-cache.c +++ b/read-cache.c @@ -1371,6 +1371,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, const char *typechange_fmt; const char *added_fmt; const char *unmerged_fmt; + uint64_t start = getnanotime(); modified_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n"); deleted_fmt = (in_porcelain ? "D\t%s\n" : "%s: needs update\n"); @@ -1441,6 +1442,7 @@ int refresh_index(struct index_state *istate, unsigned int flags, replace_index_entry(istate, i, new); } + trace_performance_since(start, "refresh index"); return has_errors; } @@ -1871,6 +1873,7 @@ static void freshen_shared_index(const char *shared_index, int warn) int read_index_from(struct index_state *istate, const char *path, const char *gitdir) { + uint64_t start = getnanotime(); struct split_index *split_index; int ret; char *base_sha1_hex; @@ -1881,6 +1884,7 @@ int read_index_from(struct index_state *istate, const char *path, return istate->cache_nr; ret = do_read_index(istate, path, 0); + trace_performance_since(start, "read cache %s", path); split_index = istate->split_index; if (!split_index || is_null_sha1(split_index->base_sha1)) { @@ -1904,6 +1908,7 @@ int read_index_from(struct index_state *istate, const char *path, freshen_shared_index(base_path, 0); merge_base_index(istate); post_read_index_from(istate); + trace_performance_since(start, "read cache %s", base_path); free(base_path); return ret; } @@ -2233,6 +2238,7 @@ void update_index_if_able(struct index_state *istate, struct lock_file *lockfile static int do_write_index(struct index_state *istate, struct tempfile *tempfile, int strip_extensions) { + uint64_t start = getnanotime(); int newfd = tempfile->fd; git_SHA_CTX c; struct cache_header hdr; @@ -2373,6 +2379,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile, return -1; istate->timestamp.sec = (unsigned int)st.st_mtime; istate->timestamp.nsec = ST_MTIME_NSEC(st); + trace_performance_since(start, "write index, changed mask = %x", istate->cache_changed); return 0; } |