Skip to content

Commit 328220f

Browse files
derrickstoleedscho
authored andcommitted
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 36e6b20 + d5c1e3b commit 328220f

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)