Skip to content

Commit d9bbeed

Browse files
derrickstoleejeffhostetler
authored andcommitted
pack-objects: add trace2 regions
When studying the performance of 'git push' we would like to know how much time is spent at various parts of the command. One area that could cause performance trouble is 'git pack-objects'. Add trace2 regions around the three main actions taken in this command: 1. Enumerate objects. 2. Prepare pack. 3. Write pack-file. Signed-off-by: Derrick Stolee <[email protected]>
1 parent 517c6d8 commit d9bbeed

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

builtin/pack-objects.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "object-store.h"
3434
#include "dir.h"
3535
#include "midx.h"
36+
#include "trace2.h"
3637

3738
#define IN_PACK(obj) oe_in_pack(&to_pack, obj)
3839
#define SIZE(obj) oe_size(&to_pack, obj)
@@ -3478,6 +3479,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34783479
}
34793480
}
34803481

3482+
trace2_region_enter("pack-objects", "enumerate-objects", the_repository);
34813483
prepare_packing_data(&to_pack);
34823484

34833485
if (progress)
@@ -3492,12 +3494,20 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34923494
if (include_tag && nr_result)
34933495
for_each_ref(add_ref_tag, NULL);
34943496
stop_progress(&progress_state);
3497+
trace2_region_leave("pack-objects", "enumerate-objects", the_repository);
34953498

34963499
if (non_empty && !nr_result)
34973500
return 0;
3498-
if (nr_result)
3501+
if (nr_result) {
3502+
trace2_region_enter("pack-objects", "prepare-pack", the_repository);
34993503
prepare_pack(window, depth);
3504+
trace2_region_leave("pack-objects", "prepare-pack", the_repository);
3505+
}
3506+
3507+
trace2_region_enter("pack-objects", "write-pack-file", the_repository);
35003508
write_pack_file();
3509+
trace2_region_leave("pack-objects", "write-pack-file", the_repository);
3510+
35013511
if (progress)
35023512
fprintf_ln(stderr,
35033513
_("Total %"PRIu32" (delta %"PRIu32"),"

0 commit comments

Comments
 (0)