Skip to content

Commit d5c1e3b

Browse files
derrickstoleedscho
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 36e6b20 commit d5c1e3b

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)
@@ -3470,6 +3471,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34703471
}
34713472
}
34723473

3474+
trace2_region_enter("pack-objects", "enumerate-objects", the_repository);
34733475
prepare_packing_data(&to_pack);
34743476

34753477
if (progress)
@@ -3484,12 +3486,20 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34843486
if (include_tag && nr_result)
34853487
for_each_ref(add_ref_tag, NULL);
34863488
stop_progress(&progress_state);
3489+
trace2_region_leave("pack-objects", "enumerate-objects", the_repository);
34873490

34883491
if (non_empty && !nr_result)
34893492
return 0;
3490-
if (nr_result)
3493+
if (nr_result) {
3494+
trace2_region_enter("pack-objects", "prepare-pack", the_repository);
34913495
prepare_pack(window, depth);
3496+
trace2_region_leave("pack-objects", "prepare-pack", the_repository);
3497+
}
3498+
3499+
trace2_region_enter("pack-objects", "write-pack-file", the_repository);
34923500
write_pack_file();
3501+
trace2_region_leave("pack-objects", "write-pack-file", the_repository);
3502+
34933503
if (progress)
34943504
fprintf_ln(stderr,
34953505
_("Total %"PRIu32" (delta %"PRIu32"),"

0 commit comments

Comments
 (0)