Skip to content

Commit 54393e4

Browse files
ttaylorrgitster
authored andcommitted
pack-objects: add tracing for various packfile metrics
As part of the multi-pack reuse effort, we will want to add some tests that assert that we reused a certain number of objects from a certain number of packs. We could do this by grepping through the stderr output of `pack-objects`, but doing so would be brittle in case the output format changed. Instead, let's use the trace2 mechanism to log various pieces of information about the generated packfile, which we can then use to compare against desired values. Signed-off-by: Taylor Blau <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 519e17f commit 54393e4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

builtin/pack-objects.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4595,6 +4595,13 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
45954595
reuse_packfile_objects,
45964596
(uintmax_t)reuse_packfiles_used_nr);
45974597

4598+
trace2_data_intmax("pack-objects", the_repository, "written", written);
4599+
trace2_data_intmax("pack-objects", the_repository, "written/delta", written_delta);
4600+
trace2_data_intmax("pack-objects", the_repository, "reused", reused);
4601+
trace2_data_intmax("pack-objects", the_repository, "reused/delta", reused_delta);
4602+
trace2_data_intmax("pack-objects", the_repository, "pack-reused", reuse_packfile_objects);
4603+
trace2_data_intmax("pack-objects", the_repository, "packs-reused", reuse_packfiles_used_nr);
4604+
45984605
cleanup:
45994606
clear_packing_data(&to_pack);
46004607
list_objects_filter_release(&filter_options);

0 commit comments

Comments
 (0)