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 <dstolee@microsoft.com> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Derrick Stolee committed
Feb 22, 2019 at 14:25 UTC
ae417807b01b34b7fd4f1a5a9d889b34f8a563d2
1 file changed
+15
-1
builtin/pack-objects.c
+15
-1
@@ -33,6 +33,7 @@
33
#include "object-store.h"
34
#include "dir.h"
35
#include "midx.h"
36
+#include "trace2.h"
37
38
#define IN_PACK(obj) oe_in_pack(&to_pack, obj)
39
#define SIZE(obj) oe_size(&to_pack, obj)
@@ -3473,6 +3474,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3474
}
3475
}
3476
3477
+ trace2_region_enter("pack-objects", "enumerate-objects",
3478
+ the_repository);
3479
prepare_packing_data(the_repository, &to_pack);
3480
3481
if (progress)
@@ -3487,12 +3490,23 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
3490
if (include_tag && nr_result)
3491
for_each_ref(add_ref_tag, NULL);
3492
stop_progress(&progress_state);
3493
+ trace2_region_leave("pack-objects", "enumerate-objects",
3494
+ the_repository);
3495
3496
if (non_empty && !nr_result)
3497
return 0;
3493
- if (nr_result)
3498
+ if (nr_result) {
3499
+ trace2_region_enter("pack-objects", "prepare-pack",
3500
+ the_repository);
3501
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);
3507
write_pack_file();
3508
+ trace2_region_leave("pack-objects", "write-pack-file", the_repository);
3509
+
3510
if (progress)
3511
fprintf_ln(stderr,
3512
_("Total %"PRIu32" (delta %"PRIu32"),"