Skip to content

Commit cb3b9e7

Browse files
committed
Merge branch 'jh/trace2' into pu
* jh/trace2: trace2: t/helper/test-trace2, t0210.sh, t0211.sh, t0212.sh trace2:data: add subverb for rebase trace2:data: add subverb to reset command trace2:data: add subverb to checkout command pack-objects: add trace2 regions trace2:data: add trace2 instrumentation to index read/write trace2:data: add trace2 hook classification trace2:data: add trace2 transport child classification trace2:data: add trace2 sub-process classification trace2:data: add editor/pager child classification trace2:data: add trace2 regions to wt-status trace2: collect platform-specific process information trace2: create new combined trace facility trace2: Documentation/technical/api-trace2.txt
2 parents a11b5ee + 3e56cbd commit cb3b9e7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+6348
-21
lines changed

Documentation/technical/api-trace2.txt

Lines changed: 1157 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -762,6 +762,7 @@ TEST_BUILTINS_OBJS += test-string-list.o
762762
TEST_BUILTINS_OBJS += test-submodule-config.o
763763
TEST_BUILTINS_OBJS += test-submodule-nested-repo-config.o
764764
TEST_BUILTINS_OBJS += test-subprocess.o
765+
TEST_BUILTINS_OBJS += test-trace2.o
765766
TEST_BUILTINS_OBJS += test-urlmatch-normalization.o
766767
TEST_BUILTINS_OBJS += test-xml-encode.o
767768
TEST_BUILTINS_OBJS += test-wildmatch.o
@@ -1006,6 +1007,16 @@ LIB_OBJS += tempfile.o
10061007
LIB_OBJS += thread-utils.o
10071008
LIB_OBJS += tmp-objdir.o
10081009
LIB_OBJS += trace.o
1010+
LIB_OBJS += trace2.o
1011+
LIB_OBJS += trace2/tr2_cfg.o
1012+
LIB_OBJS += trace2/tr2_dst.o
1013+
LIB_OBJS += trace2/tr2_sid.o
1014+
LIB_OBJS += trace2/tr2_tbuf.o
1015+
LIB_OBJS += trace2/tr2_tgt_event.o
1016+
LIB_OBJS += trace2/tr2_tgt_normal.o
1017+
LIB_OBJS += trace2/tr2_tgt_perf.o
1018+
LIB_OBJS += trace2/tr2_tls.o
1019+
LIB_OBJS += trace2/tr2_verb.o
10091020
LIB_OBJS += trailer.o
10101021
LIB_OBJS += transport.o
10111022
LIB_OBJS += transport-helper.o

builtin/am.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,7 @@ static int run_post_rewrite_hook(const struct am_state *state)
453453

454454
cp.in = xopen(am_path(state, "rewritten"), O_RDONLY);
455455
cp.stdout_to_stderr = 1;
456+
cp.trace2_hook_name = "post-rewrite";
456457

457458
ret = run_command(&cp);
458459

builtin/checkout.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ static int checkout_paths(const struct checkout_opts *opts,
325325
struct lock_file lock_file = LOCK_INIT;
326326
int nr_checkouts = 0;
327327

328+
trace2_cmd_subverb(opts->patch_mode ? "patch" : "path");
329+
328330
if (opts->track != BRANCH_TRACK_UNSPECIFIED)
329331
die(_("'%s' cannot be used with updating paths"), "--track");
330332

@@ -1009,6 +1011,9 @@ static int switch_branches(const struct checkout_opts *opts,
10091011
void *path_to_free;
10101012
struct object_id rev;
10111013
int flag, writeout_error = 0;
1014+
1015+
trace2_cmd_subverb("branch");
1016+
10121017
memset(&old_branch_info, 0, sizeof(old_branch_info));
10131018
old_branch_info.path = path_to_free = resolve_refdup("HEAD", 0, &rev, &flag);
10141019
if (old_branch_info.path)
@@ -1252,6 +1257,8 @@ static int switch_unborn_to_new_branch(const struct checkout_opts *opts)
12521257
int status;
12531258
struct strbuf branch_ref = STRBUF_INIT;
12541259

1260+
trace2_cmd_subverb("unborn");
1261+
12551262
if (!opts->new_branch)
12561263
die(_("You are on a branch yet to be born"));
12571264
strbuf_addf(&branch_ref, "refs/heads/%s", opts->new_branch);

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)
@@ -3474,6 +3475,7 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34743475
}
34753476
}
34763477

3478+
trace2_region_enter("pack-objects", "enumerate-objects", the_repository);
34773479
prepare_packing_data(the_repository, &to_pack);
34783480

34793481
if (progress)
@@ -3488,12 +3490,20 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
34883490
if (include_tag && nr_result)
34893491
for_each_ref(add_ref_tag, NULL);
34903492
stop_progress(&progress_state);
3493+
trace2_region_leave("pack-objects", "enumerate-objects", the_repository);
34913494

34923495
if (non_empty && !nr_result)
34933496
return 0;
3494-
if (nr_result)
3497+
if (nr_result) {
3498+
trace2_region_enter("pack-objects", "prepare-pack", the_repository);
34953499
prepare_pack(window, depth);
3500+
trace2_region_leave("pack-objects", "prepare-pack", the_repository);
3501+
}
3502+
3503+
trace2_region_enter("pack-objects", "write-pack-file", the_repository);
34963504
write_pack_file();
3505+
trace2_region_leave("pack-objects", "write-pack-file", the_repository);
3506+
34973507
if (progress)
34983508
fprintf_ln(stderr,
34993509
_("Total %"PRIu32" (delta %"PRIu32"),"

builtin/rebase.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,6 +1030,16 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
10301030
ACTION_EDIT_TODO,
10311031
ACTION_SHOW_CURRENT_PATCH,
10321032
} action = NO_ACTION;
1033+
static const char *action_names[] = {
1034+
N_("undefined"),
1035+
N_("continue"),
1036+
N_("skip"),
1037+
N_("abort"),
1038+
N_("quit"),
1039+
N_("edit_todo"),
1040+
N_("show_current_patch"),
1041+
NULL
1042+
};
10331043
const char *gpg_sign = NULL;
10341044
struct string_list exec = STRING_LIST_INIT_NODUP;
10351045
const char *rebase_merges = NULL;
@@ -1219,6 +1229,15 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
12191229
die(_("The --edit-todo action can only be used during "
12201230
"interactive rebase."));
12211231

1232+
if (trace2_is_enabled()) {
1233+
if (is_interactive(&options))
1234+
trace2_cmd_subverb("interactive");
1235+
else if (exec.nr)
1236+
trace2_cmd_subverb("interactive-exec");
1237+
else
1238+
trace2_cmd_subverb(action_names[action]);
1239+
}
1240+
12221241
switch (action) {
12231242
case ACTION_CONTINUE: {
12241243
struct object_id head;

builtin/receive-pack.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,8 @@ static int run_and_feed_hook(const char *hook_name, feed_fn feed,
694694
proc.argv = argv;
695695
proc.in = -1;
696696
proc.stdout_to_stderr = 1;
697+
proc.trace2_hook_name = hook_name;
698+
697699
if (feed_state->push_options) {
698700
int i;
699701
for (i = 0; i < feed_state->push_options->nr; i++)
@@ -807,6 +809,7 @@ static int run_update_hook(struct command *cmd)
807809
proc.stdout_to_stderr = 1;
808810
proc.err = use_sideband ? -1 : 0;
809811
proc.argv = argv;
812+
proc.trace2_hook_name = "update";
810813

811814
code = start_command(&proc);
812815
if (code)
@@ -1190,6 +1193,7 @@ static void run_update_post_hook(struct command *commands)
11901193
proc.no_stdin = 1;
11911194
proc.stdout_to_stderr = 1;
11921195
proc.err = use_sideband ? -1 : 0;
1196+
proc.trace2_hook_name = "post-update";
11931197

11941198
if (!start_command(&proc)) {
11951199
if (use_sideband)

builtin/reset.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
341341
if (patch_mode) {
342342
if (reset_type != NONE)
343343
die(_("--patch is incompatible with --{hard,mixed,soft}"));
344+
trace2_cmd_subverb("patch-interactive");
344345
return run_add_interactive(rev, "--patch=reset", &pathspec);
345346
}
346347

@@ -357,6 +358,11 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
357358
if (reset_type == NONE)
358359
reset_type = MIXED; /* by default */
359360

361+
if (pathspec.nr)
362+
trace2_cmd_subverb("path");
363+
else
364+
trace2_cmd_subverb(reset_type_names[reset_type]);
365+
360366
if (reset_type != SOFT && (reset_type != MIXED || get_git_work_tree()))
361367
setup_work_tree();
362368

builtin/submodule--helper.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1816,11 +1816,12 @@ static int update_submodules(struct submodule_update_clone *suc)
18161816
{
18171817
int i;
18181818

1819-
run_processes_parallel(suc->max_jobs,
1820-
update_clone_get_next_task,
1821-
update_clone_start_failure,
1822-
update_clone_task_finished,
1823-
suc);
1819+
run_processes_parallel_tr2(suc->max_jobs,
1820+
update_clone_get_next_task,
1821+
update_clone_start_failure,
1822+
update_clone_task_finished,
1823+
suc,
1824+
"submodule", "parallel/update");
18241825

18251826
/*
18261827
* We saved the output and put it out all at once now.

builtin/worktree.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ static int add_worktree(const char *path, const char *refname,
402402
cp.dir = path;
403403
cp.env = env;
404404
cp.argv = NULL;
405+
cp.trace2_hook_name = "post-checkout";
405406
argv_array_pushl(&cp.args, absolute_path(hook),
406407
oid_to_hex(&null_oid),
407408
oid_to_hex(&commit->object.oid),

0 commit comments

Comments
 (0)