Merge branch 'nd/trace-index-ops' into next
authorJunio C Hamano <gitster@pobox.com>
Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)
committerJunio C Hamano <gitster@pobox.com>
Thu, 8 Feb 2018 23:08:28 +0000 (15:08 -0800)
* nd/trace-index-ops:
trace: measure where the time is spent in the index-heavy operations

1  2 
dir.c
read-cache.c
diff --cc dir.c
Simple merge
diff --cc read-cache.c
index 6339e61760e9fbd59f341016903fc78143d30e53,eac74bc9f17d69c304461a3174e3ee0888ea1be9..28bf0db9d95777659ffe43d994f4970b46a78f56
@@@ -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;
                    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;
  }
  
@@@ -2233,8 -2239,9 +2238,9 @@@ void update_index_if_able(struct index_
  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;
 +      git_hash_ctx c;
        struct cache_header hdr;
        int i, err = 0, removed, extended, hdr_version;
        struct cache_entry **cache = istate->cache;