Re: [PATCH 5/9] name-hash: use trace2 regions for init
- From
Elijah Newren <newren@gmail.com>
- Date
- Jan 20, 2021, 17:47 UTC
- Message-ID
- <CABPp-BEhJDd=Om49Cpb2CuuHn_UBuNaxJjGKZEhWfY3r3vcefA@mail.gmail.com>
- In-Reply-To
- <3ba4b35f09cf3dc313787cdec6856286fe97d8a8.1611161639.git.gitgitgadget@gmail.com>
On Wed, Jan 20, 2021 at 8:54 AM Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com> wrote:
Show 45 quoted lines
>
> From: Derrick Stolee <dstolee@microsoft.com>
>
> The lazy_init_name_hash() populates a hashset with all filenames and
> another with all directories represented in the index. This is run only
> if we need to use the hashsets to check for existence or case-folding
> renames.
>
> Place trace2 regions where there is already a performance trace.
>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
> name-hash.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/name-hash.c b/name-hash.c
> index 5d3c7b12c18..4e03fac9bb1 100644
> --- a/name-hash.c
> +++ b/name-hash.c
> @@ -7,6 +7,7 @@
> */
> #include "cache.h"
> #include "thread-utils.h"
> +#include "trace2.h"
>
> struct dir_entry {
> struct hashmap_entry ent;
> @@ -577,6 +578,7 @@ static void lazy_init_name_hash(struct index_state *istate)
> if (istate->name_hash_initialized)
> return;
> trace_performance_enter();
> + trace2_region_enter("index", "name-hash-init", istate->repo);
> hashmap_init(&istate->name_hash, cache_entry_cmp, NULL, istate->cache_nr);
> hashmap_init(&istate->dir_hash, dir_entry_cmp, NULL, istate->cache_nr);
>
> @@ -597,6 +599,7 @@ static void lazy_init_name_hash(struct index_state *istate)
> }
>
> istate->name_hash_initialized = 1;
> + trace2_region_leave("index", "name-hash-init", istate->repo);
> trace_performance_leave("initialize name hash");
> }
>
> --
> gitgitgadgetYaay for trace2. :-)
Total sidenote: Are we ever going to get rid of the trace1 stuff? I'm sure this was discussed somewhere, but I don't know where.