[v2,07/11] trace2: add region in clear_ce_flags
diff mbox series

Message ID 25642f8df28825cce61812a24cbd87bf7cb2025f.1568904188.git.gitgitgadget@gmail.com
State New
Headers show
Series
  • New sparse-checkout builtin and "cone" mode
Related show

Commit Message

Elijah Newren via GitGitGadget Sept. 19, 2019, 2:43 p.m. UTC
From: Jeff Hostetler <jeffhost@microsoft.com>

When Git updates the working directory with the sparse-checkout
feature enabled, the unpack_trees() method calls clear_ce_flags()
to update the skip-wortree bits on the cache entries. This
check can be expensive, depending on the patterns used.

Add trace2 regions around the method, including some flag
information, so we can get granular performance data during
experiments. This data will be used to measure improvements
to the pattern-matching algorithms for sparse-checkout.

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
---
 unpack-trees.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

Comments

Elijah Newren Oct. 6, 2019, 4:13 a.m. UTC | #1
On Thu, Sep 19, 2019 at 10:15 AM Jeff Hostetler via GitGitGadget
<gitgitgadget@gmail.com> wrote:
>
> From: Jeff Hostetler <jeffhost@microsoft.com>
>
> When Git updates the working directory with the sparse-checkout
> feature enabled, the unpack_trees() method calls clear_ce_flags()
> to update the skip-wortree bits on the cache entries. This
> check can be expensive, depending on the patterns used.
>
> Add trace2 regions around the method, including some flag
> information, so we can get granular performance data during
> experiments. This data will be used to measure improvements
> to the pattern-matching algorithms for sparse-checkout.
>
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
>  unpack-trees.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/unpack-trees.c b/unpack-trees.c
> index cd548f4fa2..26be8f3569 100644
> --- a/unpack-trees.c
> +++ b/unpack-trees.c
> @@ -1404,15 +1404,23 @@ static int clear_ce_flags(struct index_state *istate,
>                           struct pattern_list *pl)
>  {
>         static struct strbuf prefix = STRBUF_INIT;
> +       char label[100];
> +       int rval;
>
>         strbuf_reset(&prefix);
>
> -       return clear_ce_flags_1(istate,
> +       xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
> +                 (unsigned long)select_mask, (unsigned long)clear_mask);
> +       trace2_region_enter("unpack_trees", label, the_repository);
> +       rval = clear_ce_flags_1(istate,
>                                 istate->cache,
>                                 istate->cache_nr,
>                                 &prefix,
>                                 select_mask, clear_mask,
>                                 pl, 0);
> +       trace2_region_leave("unpack_trees", label, the_repository);
> +
> +       return rval;
>  }
>
>  /*
> --
> gitgitgadget

Thanks for the updates to the commit message, and the tweaks from
"exp" to "unpack_trees" in the patch.  I still don't know trace2, but
it's much clearer how this relates to the series now.

Patch
diff mbox series

diff --git a/unpack-trees.c b/unpack-trees.c
index cd548f4fa2..26be8f3569 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1404,15 +1404,23 @@  static int clear_ce_flags(struct index_state *istate,
 			  struct pattern_list *pl)
 {
 	static struct strbuf prefix = STRBUF_INIT;
+	char label[100];
+	int rval;
 
 	strbuf_reset(&prefix);
 
-	return clear_ce_flags_1(istate,
+	xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
+		  (unsigned long)select_mask, (unsigned long)clear_mask);
+	trace2_region_enter("unpack_trees", label, the_repository);
+	rval = clear_ce_flags_1(istate,
 				istate->cache,
 				istate->cache_nr,
 				&prefix,
 				select_mask, clear_mask,
 				pl, 0);
+	trace2_region_leave("unpack_trees", label, the_repository);
+
+	return rval;
 }
 
 /*