Skip to content

Commit 25163f5

Browse files
ttaylorrgitster
authored andcommitted
pack-bitmap: extra trace2 information
Add some extra trace2 lines to capture the number of bitmap lookups that are hits versus misses, as well as the number of reachability roots that have bitmap coverage (versus those that do not). Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 11d45a6 commit 25163f5

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

pack-bitmap.c

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,10 @@ struct bitmap_index {
116116

117117
static int pseudo_merges_satisfied_nr;
118118
static int pseudo_merges_cascades_nr;
119+
static int existing_bitmaps_hits_nr;
120+
static int existing_bitmaps_misses_nr;
121+
static int roots_with_bitmaps_nr;
122+
static int roots_without_bitmaps_nr;
119123

120124
static struct ewah_bitmap *lookup_stored_bitmap(struct stored_bitmap *st)
121125
{
@@ -1040,10 +1044,14 @@ static int add_to_include_set(struct bitmap_index *bitmap_git,
10401044

10411045
partial = bitmap_for_commit(bitmap_git, commit);
10421046
if (partial) {
1047+
existing_bitmaps_hits_nr++;
1048+
10431049
bitmap_or_ewah(data->base, partial);
10441050
return 0;
10451051
}
10461052

1053+
existing_bitmaps_misses_nr++;
1054+
10471055
bitmap_set(data->base, bitmap_pos);
10481056
if (apply_pseudo_merges_for_commit_1(bitmap_git, data->base, commit,
10491057
bitmap_pos))
@@ -1099,8 +1107,12 @@ static int add_commit_to_bitmap(struct bitmap_index *bitmap_git,
10991107
{
11001108
struct ewah_bitmap *or_with = bitmap_for_commit(bitmap_git, commit);
11011109

1102-
if (!or_with)
1110+
if (!or_with) {
1111+
existing_bitmaps_misses_nr++;
11031112
return 0;
1113+
}
1114+
1115+
existing_bitmaps_hits_nr++;
11041116

11051117
if (!*base)
11061118
*base = ewah_to_bitmap(or_with);
@@ -1407,8 +1419,12 @@ static struct bitmap *find_objects(struct bitmap_index *bitmap_git,
14071419
object->flags &= ~UNINTERESTING;
14081420
add_pending_object(revs, object, "");
14091421
needs_walk = 1;
1422+
1423+
roots_without_bitmaps_nr++;
14101424
} else {
14111425
object->flags |= SEEN;
1426+
1427+
roots_with_bitmaps_nr++;
14121428
}
14131429
}
14141430

@@ -1975,6 +1991,14 @@ struct bitmap_index *prepare_bitmap_walk(struct rev_info *revs,
19751991
pseudo_merges_satisfied_nr);
19761992
trace2_data_intmax("bitmap", the_repository, "pseudo_merges_cascades",
19771993
pseudo_merges_cascades_nr);
1994+
trace2_data_intmax("bitmap", the_repository, "bitmap/hits",
1995+
existing_bitmaps_hits_nr);
1996+
trace2_data_intmax("bitmap", the_repository, "bitmap/misses",
1997+
existing_bitmaps_misses_nr);
1998+
trace2_data_intmax("bitmap", the_repository, "bitmap/roots_with_bitmap",
1999+
roots_with_bitmaps_nr);
2000+
trace2_data_intmax("bitmap", the_repository, "bitmap/roots_without_bitmap",
2001+
roots_without_bitmaps_nr);
19782002

19792003
return bitmap_git;
19802004

0 commit comments

Comments
 (0)