Skip to content

Commit ae9c428

Browse files
derrickstoleedscho
authored andcommitted
Merge pull request git-for-windows#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 77e9be7 + fc5702e commit ae9c428

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)
@@ -3356,6 +3357,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
33563357
}
33573358
}
33583359

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

33613363
if (progress)
@@ -3370,12 +3372,20 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
33703372
if (include_tag && nr_result)
33713373
for_each_ref(add_ref_tag, NULL);
33723374
stop_progress(&progress_state);
3375+
trace2_region_leave("pack-objects", "enumerate-objects", the_repository);
33733376

33743377
if (non_empty && !nr_result)
33753378
return 0;
3376-
if (nr_result)
3379+
if (nr_result) {
3380+
trace2_region_enter("pack-objects", "prepare-pack", the_repository);
33773381
prepare_pack(window, depth);
3382+
trace2_region_leave("pack-objects", "prepare-pack", the_repository);
3383+
}
3384+
3385+
trace2_region_enter("pack-objects", "write-pack-file", the_repository);
33783386
write_pack_file();
3387+
trace2_region_leave("pack-objects", "write-pack-file", the_repository);
3388+
33793389
if (progress)
33803390
fprintf_ln(stderr,
33813391
_("Total %"PRIu32" (delta %"PRIu32"),"

0 commit comments

Comments
 (0)