Skip to content

Commit ae41780

Browse files
derrickstoleegitster
authored andcommitted
trace2:data: 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]> Signed-off-by: Jeff Hostetler <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 42fee7a commit ae41780

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

builtin/pack-objects.c

Lines changed: 15 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)
@@ -3473,6 +3474,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34733474
}
34743475
}
34753476

3477+
trace2_region_enter("pack-objects", "enumerate-objects",
3478+
the_repository);
34763479
prepare_packing_data(the_repository, &to_pack);
34773480

34783481
if (progress)
@@ -3487,12 +3490,23 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34873490
if (include_tag && nr_result)
34883491
for_each_ref(add_ref_tag, NULL);
34893492
stop_progress(&progress_state);
3493+
trace2_region_leave("pack-objects", "enumerate-objects",
3494+
the_repository);
34903495

34913496
if (non_empty && !nr_result)
34923497
return 0;
3493-
if (nr_result)
3498+
if (nr_result) {
3499+
trace2_region_enter("pack-objects", "prepare-pack",
3500+
the_repository);
34943501
prepare_pack(window, depth);
3502+
trace2_region_leave("pack-objects", "prepare-pack",
3503+
the_repository);
3504+
}
3505+
3506+
trace2_region_enter("pack-objects", "write-pack-file", the_repository);
34953507
write_pack_file();
3508+
trace2_region_leave("pack-objects", "write-pack-file", the_repository);
3509+
34963510
if (progress)
34973511
fprintf_ln(stderr,
34983512
_("Total %"PRIu32" (delta %"PRIu32"),"

0 commit comments

Comments
 (0)