Skip to content

Commit b7e53c2

Browse files
Merge pull request #34 Add Trace2 regions to 'pack-objects'
We want to make `git push` faster, but we need to know where the time is going! There are likely four places where the time is going: 1. The info/refs call and force-update checking at the beginning. 2. The `git pack-objects` call that creates a pack-file to send to the server. 3. Sending the data to the server. 4. Waiting for the server to verify the pack-file. This PR adds `trace2_region_` calls inside `git pack-objects` so we can track the time in item (2). The rest could be interpreted from the start and end time of the entire command after we know this region. The server-side verification is something we can track using server telemetry.
2 parents 6ee82ac + c5856e0 commit b7e53c2

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
@@ -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)