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 <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Taylor Blau committed
Oct 12, 2022 at 18:01 UTC
e9c383994493f3b775191aed13811a868aa639da
1 file changed
+7
-1
pack-bitmap-write.c
+7
-1
@@ -384,6 +384,8 @@ static int fill_bitmap_tree(struct bitmap *bitmap,
384
return 0;
385
}
386
387
+static int reused_bitmaps_nr;
388
+
389
static int fill_bitmap_commit(struct bb_commit *ent,
390
struct commit *commit,
391
struct prio_queue *queue,
@@ -409,8 +411,10 @@ static int fill_bitmap_commit(struct bb_commit *ent,
411
* bitmap and add its bits to this one. No need to walk
412
* parents or the tree for this commit.
413
*/
412
- if (old && !rebuild_bitmap(mapping, old, ent->bitmap))
414
+ if (old && !rebuild_bitmap(mapping, old, ent->bitmap)) {
415
+ reused_bitmaps_nr++;
416
continue;
417
+ }
418
}
419
420
/*
@@ -526,6 +530,8 @@ int bitmap_writer_build(struct packing_data *to_pack)
530
531
trace2_region_leave("pack-bitmap-write", "building_bitmaps_total",
532
the_repository);
533
+ trace2_data_intmax("pack-bitmap-write", the_repository,
534
+ "building_bitmaps_reused", reused_bitmaps_nr);
535
536
stop_progress(&writer.progress);
537