Skip to content

Commit c5856e0

Browse files
committed
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 <dstolee@microsoft.com>
1 parent 6ee82ac commit c5856e0

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

builtin/pack-objects.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "packfile.h"
3232
#include "object-store.h"
3333
#include "dir.h"
34+
#include "trace2.h"
3435

3536
#define IN_PACK(obj) oe_in_pack(&to_pack, obj)
3637
#define SIZE(obj) oe_size(&to_pack, obj)
@@ -3357,6 +3358,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
33573358
}
33583359
}
33593360

3361+
trace2_region_enter("pack-objects", "enumerate-objects", the_repository);
33603362
prepare_packing_data(&to_pack);
33613363

33623364
if (progress)
@@ -3371,12 +3373,20 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
33713373
if (include_tag && nr_result)
33723374
for_each_ref(add_ref_tag, NULL);
33733375
stop_progress(&progress_state);
3376+
trace2_region_leave("pack-objects", "enumerate-objects", the_repository);
33743377

33753378
if (non_empty && !nr_result)
33763379
return 0;
3377-
if (nr_result)
3380+
if (nr_result) {
3381+
trace2_region_enter("pack-objects", "prepare-pack", the_repository);
33783382
prepare_pack(window, depth);
3383+
trace2_region_leave("pack-objects", "prepare-pack", the_repository);
3384+
}
3385+
3386+
trace2_region_enter("pack-objects", "write-pack-file", the_repository);
33793387
write_pack_file();
3388+
trace2_region_leave("pack-objects", "write-pack-file", the_repository);
3389+
33803390
if (progress)
33813391
fprintf_ln(stderr,
33823392
_("Total %"PRIu32" (delta %"PRIu32"),"

0 commit comments

Comments
 (0)