From: Junio C Hamano Date: Thu, 15 Feb 2018 22:55:44 +0000 (-0800) Subject: Merge branch 'nd/trace-index-ops' X-Git-Tag: v2.17.0-rc0~93 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=090dbea6843f860de8c981d97d031621176fc2be;p=git Merge branch 'nd/trace-index-ops' * nd/trace-index-ops: trace: measure where the time is spent in the index-heavy operations --- 090dbea6843f860de8c981d97d031621176fc2be diff --cc read-cache.c index f9871cde33,eac74bc9f1..82ba2287e1 --- a/read-cache.c +++ b/read-cache.c @@@ -1862,15 -1865,17 +1864,16 @@@ unmap * This way, shared index can be removed if they have not been used * for some time. */ -static void freshen_shared_index(char *base_sha1_hex, int warn) +static void freshen_shared_index(const char *shared_index, int warn) { - char *shared_index = git_pathdup("sharedindex.%s", base_sha1_hex); if (!check_and_freshen_file(shared_index, 1) && warn) warning("could not freshen shared index '%s'", shared_index); - free(shared_index); } -int read_index_from(struct index_state *istate, const char *path) +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; @@@ -1901,10 -1907,10 +1905,11 @@@ base_sha1_hex, base_path, sha1_to_hex(split_index->base->sha1)); - freshen_shared_index(base_sha1_hex, 0); + 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; }