Skip to content

Commit e9c3839

Browse files
ttaylorrgitster
authored andcommitted
pack-bitmap-write.c: instrument number of reused bitmaps
When debugging bitmap generation performance, it is useful to know how many bitmaps were generated from scratch, and how many were the result of permuting the bit-order of an existing bitmap. Keep track of the latter, and emit the count as a trace2_data line to aid in debugging. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2dcff52 commit e9c3839

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pack-bitmap-write.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,8 @@ static int fill_bitmap_tree(struct bitmap *bitmap,
384384
return 0;
385385
}
386386

387+
static int reused_bitmaps_nr;
388+
387389
static int fill_bitmap_commit(struct bb_commit *ent,
388390
struct commit *commit,
389391
struct prio_queue *queue,
@@ -409,8 +411,10 @@ static int fill_bitmap_commit(struct bb_commit *ent,
409411
* bitmap and add its bits to this one. No need to walk
410412
* parents or the tree for this commit.
411413
*/
412-
if (old && !rebuild_bitmap(mapping, old, ent->bitmap))
414+
if (old && !rebuild_bitmap(mapping, old, ent->bitmap)) {
415+
reused_bitmaps_nr++;
413416
continue;
417+
}
414418
}
415419

416420
/*
@@ -526,6 +530,8 @@ int bitmap_writer_build(struct packing_data *to_pack)
526530

527531
trace2_region_leave("pack-bitmap-write", "building_bitmaps_total",
528532
the_repository);
533+
trace2_data_intmax("pack-bitmap-write", the_repository,
534+
"building_bitmaps_reused", reused_bitmaps_nr);
529535

530536
stop_progress(&writer.progress);
531537

0 commit comments

Comments
 (0)