Skip to content

Commit 095fc20

Browse files
committed
Revert "trace2: create new combined trace facility"
This reverts commit 1354d73.
1 parent fed7162 commit 095fc20

33 files changed

+12
-3391
lines changed

Makefile

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,15 +1000,6 @@ LIB_OBJS += tempfile.o
10001000
LIB_OBJS += thread-utils.o
10011001
LIB_OBJS += tmp-objdir.o
10021002
LIB_OBJS += trace.o
1003-
LIB_OBJS += trace2.o
1004-
LIB_OBJS += trace2/tr2_cfg.o
1005-
LIB_OBJS += trace2/tr2_dst.o
1006-
LIB_OBJS += trace2/tr2_sid.o
1007-
LIB_OBJS += trace2/tr2_tbuf.o
1008-
LIB_OBJS += trace2/tr2_tgt_event.o
1009-
LIB_OBJS += trace2/tr2_tgt_normal.o
1010-
LIB_OBJS += trace2/tr2_tgt_perf.o
1011-
LIB_OBJS += trace2/tr2_tls.o
10121003
LIB_OBJS += trailer.o
10131004
LIB_OBJS += transport.o
10141005
LIB_OBJS += transport-helper.o

cache.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
#include "gettext.h"
1010
#include "convert.h"
1111
#include "trace.h"
12-
#include "trace2.h"
1312
#include "string-list.h"
1413
#include "pack-revindex.h"
1514
#include "hash.h"

common-main.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ int main(int argc, const char **argv)
3131
* onto stdin/stdout/stderr in the child processes we spawn.
3232
*/
3333
sanitize_stdfds();
34-
restore_sigpipe_to_default();
35-
36-
trace2_initialize(argv);
3734

3835
git_resolve_executable_dir(argv[0]);
3936

@@ -43,5 +40,7 @@ int main(int argc, const char **argv)
4340

4441
attr_start();
4542

43+
restore_sigpipe_to_default();
44+
4645
return cmd_main(argc, argv);
4746
}

compat/mingw.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,6 @@ static int try_shell_exec(const char *cmd, char *const *argv)
19591959
int status;
19601960
if (waitpid(pid, &status, 0) < 0)
19611961
status = 255;
1962-
trace2_exec_result(status);
19631962
exit(status);
19641963
}
19651964
pid = 1; /* indicate that we tried but failed */
@@ -1980,7 +1979,6 @@ int mingw_execv(const char *cmd, char *const *argv)
19801979
return -1;
19811980
if (waitpid(pid, &status, 0) < 0)
19821981
status = 255;
1983-
trace2_exec_result(status);
19841982
exit(status);
19851983
}
19861984
return -1;

compat/mingw.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ static inline int fcntl(int fd, int cmd, ...)
165165
errno = EINVAL;
166166
return -1;
167167
}
168-
168+
/* bash cannot reliably detect negative return codes as failure */
169+
#define exit(code) exit((code) & 0xff)
169170
#define sigemptyset(x) (void)0
170171
static inline int sigaddset(sigset_t *set, int signum)
171172
{ return 0; }

config.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2709,8 +2709,6 @@ int git_config_set_gently(const char *key, const char *value)
27092709
void git_config_set(const char *key, const char *value)
27102710
{
27112711
git_config_set_multivar(key, value, NULL, 0);
2712-
2713-
trace2_cmd_set_config(key, value);
27142712
}
27152713

27162714
/*

exec-cmd.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,6 @@ static int git_get_exec_path(struct strbuf *buf, const char *argv0)
209209
return -1;
210210
}
211211

212-
trace2_cmd_path(buf->buf);
213-
214212
return 0;
215213
}
216214

@@ -330,22 +328,16 @@ const char **prepare_git_cmd(struct argv_array *out, const char **argv)
330328
int execv_git_cmd(const char **argv)
331329
{
332330
struct argv_array nargv = ARGV_ARRAY_INIT;
333-
int err;
334331

335332
prepare_git_cmd(&nargv, argv);
336333
trace_argv_printf(nargv.argv, "trace: exec:");
337-
trace2_exec("git", (const char **)nargv.argv);
338334

339335
/* execvp() can only ever return if it fails */
340336
sane_execvp("git", (char **)nargv.argv);
341337

342-
err = errno;
343-
trace_printf("trace: exec failed: %s\n", strerror(err));
344-
trace2_exec_result(err);
338+
trace_printf("trace: exec failed: %s\n", strerror(errno));
345339

346340
argv_array_clear(&nargv);
347-
348-
errno = err;
349341
return -1;
350342
}
351343

git-compat-util.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,13 +1291,6 @@ struct fscache;
12911291

12921292
extern int cmd_main(int, const char **);
12931293

1294-
/*
1295-
* Intercept all calls to exit() and route them to trace2 to
1296-
* optionally emit a message before calling the real exit().
1297-
*/
1298-
int trace2_cmd_exit_fl(const char *file, int line, int code);
1299-
#define exit(code) exit(trace2_cmd_exit_fl(__FILE__, __LINE__, (code)))
1300-
13011294
/*
13021295
* You can mark a stack variable with UNLEAK(var) to avoid it being
13031296
* reported as a leak by tools like LSAN or valgrind. The argument

git.c

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -149,20 +149,16 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
149149
git_set_exec_path(cmd + 1);
150150
else {
151151
puts(git_exec_path());
152-
trace2_cmd_verb("_query_");
153152
exit(0);
154153
}
155154
} else if (!strcmp(cmd, "--html-path")) {
156155
puts(system_path(GIT_HTML_PATH));
157-
trace2_cmd_verb("_query_");
158156
exit(0);
159157
} else if (!strcmp(cmd, "--man-path")) {
160158
puts(system_path(GIT_MAN_PATH));
161-
trace2_cmd_verb("_query_");
162159
exit(0);
163160
} else if (!strcmp(cmd, "--info-path")) {
164161
puts(system_path(GIT_INFO_PATH));
165-
trace2_cmd_verb("_query_");
166162
exit(0);
167163
} else if (!strcmp(cmd, "-p") || !strcmp(cmd, "--paginate")) {
168164
use_pager = 1;
@@ -291,7 +287,6 @@ static int handle_options(const char ***argv, int *argc, int *envchanged)
291287
(*argv)++;
292288
(*argc)--;
293289
} else if (skip_prefix(cmd, "--list-cmds=", &cmd)) {
294-
trace2_cmd_verb("_query_");
295290
if (!strcmp(cmd, "parseopt")) {
296291
struct string_list list = STRING_LIST_INIT_DUP;
297292
int i;
@@ -339,14 +334,9 @@ static int handle_alias(int *argcp, const char ***argv)
339334
commit_pager_choice();
340335

341336
child.use_shell = 1;
342-
child.trace2_child_class = "shell_alias";
343337
argv_array_push(&child.args, alias_string + 1);
344338
argv_array_pushv(&child.args, (*argv) + 1);
345339

346-
trace2_cmd_alias(alias_command, child.args.argv);
347-
trace2_cmd_list_config();
348-
trace2_cmd_verb("_run_shell_alias_");
349-
350340
ret = run_command(&child);
351341
if (ret >= 0) /* normal exit */
352342
exit(ret);
@@ -381,9 +371,6 @@ static int handle_alias(int *argcp, const char ***argv)
381371
/* insert after command name */
382372
memcpy(new_argv + count, *argv + 1, sizeof(char *) * *argcp);
383373

384-
trace2_cmd_alias(alias_command, new_argv);
385-
trace2_cmd_list_config();
386-
387374
*argv = new_argv;
388375
*argcp += count - 1;
389376

@@ -496,8 +483,6 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
496483
die("pre-command hook aborted command");
497484

498485
trace_argv_printf(argv, "trace: built-in: git");
499-
trace2_cmd_verb(p->cmd);
500-
trace2_cmd_list_config();
501486

502487
validate_cache_entries(&the_index);
503488
exit_code = status = p->fn(argc, argv, prefix);
@@ -755,34 +740,23 @@ static void execv_dashed_external(const char **argv)
755740
cmd.clean_on_exit = 1;
756741
cmd.wait_after_clean = 1;
757742
cmd.silent_exec_failure = 1;
758-
cmd.trace2_child_class = "dashed";
759743

760744
if (run_pre_command_hook(cmd.args.argv))
761745
die("pre-command hook aborted command");
762746

763747
trace_argv_printf(cmd.args.argv, "trace: exec:");
764-
trace2_exec(NULL, cmd.args.argv);
765748

766749
/*
767750
* If we fail because the command is not found, it is
768751
* OK to return. Otherwise, we just pass along the status code,
769752
* or our usual generic code if we were not even able to exec
770753
* the program.
771-
*
772-
* If the child process ran and we are now going to exit, emit a
773-
* generic string as our trace2 command verb to indicate that we
774-
* launched a dashed command.
775754
*/
776755
exit_code = status = run_command(&cmd);
777-
trace2_exec_result(status);
778-
if (status >= 0) {
779-
trace2_cmd_verb("_run_dashed_");
756+
if (status >= 0)
780757
exit(status);
781-
}
782-
else if (errno != ENOENT) {
783-
trace2_cmd_verb("_run_dashed_");
758+
else if (errno != ENOENT)
784759
exit(128);
785-
}
786760

787761
run_post_command_hook();
788762
}
@@ -809,15 +783,6 @@ static int run_argv(int *argcp, const char ***argv)
809783
struct argv_array args = ARGV_ARRAY_INIT;
810784
int i;
811785

812-
/*
813-
* The current process is committed to launching a
814-
* child process to run the command named in (**argv)
815-
* and exiting. Log a generic string as the trace2
816-
* command verb to indicate this. Note that the child
817-
* process will log the actual verb when it runs.
818-
*/
819-
trace2_cmd_verb("_run_git_alias_");
820-
821786
if (get_super_prefix())
822787
die("%s doesn't support --super-prefix", **argv);
823788

@@ -833,8 +798,8 @@ static int run_argv(int *argcp, const char ***argv)
833798
* if we fail because the command is not found, it is
834799
* OK to return. Otherwise, we just pass along the status code.
835800
*/
836-
i = run_command_v_opt_tr2(args.argv, RUN_SILENT_EXEC_FAILURE |
837-
RUN_CLEAN_ON_EXIT, "git_alias");
801+
i = run_command_v_opt(args.argv, RUN_SILENT_EXEC_FAILURE |
802+
RUN_CLEAN_ON_EXIT);
838803
if (i >= 0 || errno != ENOENT)
839804
exit(i);
840805
die("could not execute builtin %s", **argv);
@@ -965,5 +930,5 @@ int cmd_main(int argc, const char **argv)
965930
fprintf(stderr, _("failed to run command '%s': %s\n"),
966931
cmd, strerror(errno));
967932

968-
return trace2_cmd_exit(1);
933+
return 1;
969934
}

remote-curl.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1340,13 +1340,6 @@ int cmd_main(int argc, const char **argv)
13401340
string_list_init(&options.deepen_not, 1);
13411341
string_list_init(&options.push_options, 1);
13421342

1343-
/*
1344-
* Just report "remote-curl" here (folding all the various aliases
1345-
* ("git-remote-http", "git-remote-https", and etc.) here since they
1346-
* are all just copies of the same actual executable.
1347-
*/
1348-
trace2_cmd_verb("remote-curl");
1349-
13501343
remote = remote_get(argv[1]);
13511344

13521345
if (argc > 2) {

repository.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ static int repo_init_gitdir(struct repository *repo, const char *gitdir)
113113
void repo_set_worktree(struct repository *repo, const char *path)
114114
{
115115
repo->worktree = real_pathdup(path, 1);
116-
117-
trace2_def_repo(repo);
118116
}
119117

120118
static int read_and_verify_repository_format(struct repository_format *format,

repository.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ struct repository {
9090
/* Repository's current hash algorithm, as serialized on disk. */
9191
const struct git_hash_algo *hash_algo;
9292

93-
/* A unique-id for tracing purposes. */
94-
int trace2_repo_id;
95-
9693
/* Configurations */
9794

9895
/* Indicate if a repository has a different 'commondir' from 'gitdir' */

run-command.c

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -713,7 +713,6 @@ int start_command(struct child_process *cmd)
713713
cmd->err = fderr[0];
714714
}
715715

716-
trace2_child_start(cmd);
717716
trace_run_command(cmd);
718717

719718
fflush(NULL);
@@ -928,8 +927,6 @@ int start_command(struct child_process *cmd)
928927
#endif
929928

930929
if (cmd->pid < 0) {
931-
trace2_child_exit(cmd, -1);
932-
933930
if (need_in)
934931
close_pair(fdin);
935932
else if (cmd->in)
@@ -968,16 +965,13 @@ int start_command(struct child_process *cmd)
968965
int finish_command(struct child_process *cmd)
969966
{
970967
int ret = wait_or_whine(cmd->pid, cmd->argv[0], 0);
971-
trace2_child_exit(cmd, ret);
972968
child_process_clear(cmd);
973969
return ret;
974970
}
975971

976972
int finish_command_in_signal(struct child_process *cmd)
977973
{
978-
int ret = wait_or_whine(cmd->pid, cmd->argv[0], 1);
979-
trace2_child_exit(cmd, ret);
980-
return ret;
974+
return wait_or_whine(cmd->pid, cmd->argv[0], 1);
981975
}
982976

983977

@@ -999,18 +993,7 @@ int run_command_v_opt(const char **argv, int opt)
999993
return run_command_v_opt_cd_env(argv, opt, NULL, NULL);
1000994
}
1001995

1002-
int run_command_v_opt_tr2(const char **argv, int opt, const char *tr2_class)
1003-
{
1004-
return run_command_v_opt_cd_env_tr2(argv, opt, NULL, NULL, tr2_class);
1005-
}
1006-
1007996
int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const char *const *env)
1008-
{
1009-
return run_command_v_opt_cd_env_tr2(argv, opt, dir, env, NULL);
1010-
}
1011-
1012-
int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir, const char *const *env,
1013-
const char *tr2_class)
1014997
{
1015998
struct child_process cmd = CHILD_PROCESS_INIT;
1016999
cmd.argv = argv;
@@ -1022,7 +1005,6 @@ int run_command_v_opt_cd_env_tr2(const char **argv, int opt, const char *dir, co
10221005
cmd.clean_on_exit = opt & RUN_CLEAN_ON_EXIT ? 1 : 0;
10231006
cmd.dir = dir;
10241007
cmd.env = env;
1025-
cmd.trace2_child_class = tr2_class;
10261008
return run_command(&cmd);
10271009
}
10281010

@@ -1866,15 +1848,6 @@ int run_processes_parallel(int n,
18661848
int output_timeout = 100;
18671849
int spawn_cap = 4;
18681850
struct parallel_processes pp;
1869-
/*
1870-
* TODO Currently all callers of run_processes_parallel()
1871-
* are in the submodule code, so hard-coding the category
1872-
* is OK for now. Later, pass in category to this function.
1873-
*/
1874-
const char *category = "submodule";
1875-
1876-
trace2_region_enter_printf(category, "run_pp", NULL,
1877-
"max:%d", ((n < 1) ? online_cpus() : n));
18781851

18791852
pp_init(&pp, n, get_next_task, start_failure, task_finished, pp_cb);
18801853
while (1) {
@@ -1904,8 +1877,5 @@ int run_processes_parallel(int n,
19041877
}
19051878

19061879
pp_cleanup(&pp);
1907-
1908-
trace2_region_leave(category, "run_pp", NULL);
1909-
19101880
return 0;
19111881
}

0 commit comments

Comments
 (0)