@@ -1371,6 +1371,7 @@ int refresh_index(struct index_state *istate, unsigned int flags,
13711371 const char * typechange_fmt ;
13721372 const char * added_fmt ;
13731373 const char * unmerged_fmt ;
1374+ uint64_t start = getnanotime ();
13741375
13751376 modified_fmt = (in_porcelain ? "M\t%s\n" : "%s: needs update\n" );
13761377 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,
14411442
14421443 replace_index_entry (istate , i , new );
14431444 }
1445+ trace_performance_since (start , "refresh index" );
14441446 return has_errors ;
14451447}
14461448
@@ -1871,6 +1873,7 @@ static void freshen_shared_index(const char *shared_index, int warn)
18711873int read_index_from (struct index_state * istate , const char * path ,
18721874 const char * gitdir )
18731875{
1876+ uint64_t start = getnanotime ();
18741877 struct split_index * split_index ;
18751878 int ret ;
18761879 char * base_sha1_hex ;
@@ -1881,6 +1884,7 @@ int read_index_from(struct index_state *istate, const char *path,
18811884 return istate -> cache_nr ;
18821885
18831886 ret = do_read_index (istate , path , 0 );
1887+ trace_performance_since (start , "read cache %s" , path );
18841888
18851889 split_index = istate -> split_index ;
18861890 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,
19041908 freshen_shared_index (base_path , 0 );
19051909 merge_base_index (istate );
19061910 post_read_index_from (istate );
1911+ trace_performance_since (start , "read cache %s" , base_path );
19071912 free (base_path );
19081913 return ret ;
19091914}
@@ -2233,6 +2238,7 @@ void update_index_if_able(struct index_state *istate, struct lock_file *lockfile
22332238static int do_write_index (struct index_state * istate , struct tempfile * tempfile ,
22342239 int strip_extensions )
22352240{
2241+ uint64_t start = getnanotime ();
22362242 int newfd = tempfile -> fd ;
22372243 git_SHA_CTX c ;
22382244 struct cache_header hdr ;
@@ -2373,6 +2379,7 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
23732379 return -1 ;
23742380 istate -> timestamp .sec = (unsigned int )st .st_mtime ;
23752381 istate -> timestamp .nsec = ST_MTIME_NSEC (st );
2382+ trace_performance_since (start , "write index, changed mask = %x" , istate -> cache_changed );
23762383 return 0 ;
23772384}
23782385
0 commit comments