Chrome Release Bot (LUCI) 4762b62e7d Publish DEPS for 106.0.5249.13 | 1 年之前 | |
---|---|---|
.. | ||
tests | 1 年之前 | |
CMakeLists.txt | 1 年之前 | |
README.md | 1 年之前 | |
TraceAnnotator.cpp | 1 年之前 |
A tool to annotate functions with c++ TRACE_EVENT
. This tool serves two
workflows:
The goal of this tool is to transfer a function:
int foo(int bar, int baz) {
return 42;
}
into:
int foo(int bar, int baz) {
TRACE_EVENT0("test", "foo");
return 42;
}
In future also argument tracing is to be supported.
This document is based on //docs/clang_tool_refactoring.md
The following might take approx. 2 hours depending on your computer.
shell cr build all
To make sure all files have been generated.shell cp -R third_party/llvm-build ~
shell tools/clang/scripts/build.py --bootstrap --without-android
--without-fuchsia --extra-tools trace_annotator
shell cp -R ~/llvm-build third_party
This should enable goma support
again.shell cd third_party/llvm-build/Release+Asserts
shell ninja trace_annotator
Beware that running shell gclient sync
might overwrite the build and
another full build might be necessary. A backup of the binary from
//third_party/llvm-build/Release+Asserts/bin/trace_annotator might be useful.
shell tools/clang/scripts/test_tool.py --apply-edits trace_annotator
shell gn args out/Debug/
and
add: clang_use_chrome_plugins = false
option.Make sure you have up to date compilation database:
shell tools/clang/scripts/generate_compdb.py -p
out/Debug/ > out/Debug/compile_commands.json
shell DIR="net"; \
git checkout $DIR && tools/clang/scripts/run_tool.py --tool trace_annotator -p out/Debug/ $DIR \
| tools/clang/scripts/extract_edits.py \
| tools/clang/scripts/apply_edits.py -p out/Debug $DIR \
&& git cl format $DIR
Consult documentation of //tools/clang/scripts/run_tool.py
for more
options.
Do not run the tool on //base or anything that has to do with tracing or synchronization. Or at least do not submit the resulting patch.
shell git add . ; git commit
shell git add . ; git commit
shell git add . ; git commit
shell git rebase -i
and follow the help.c++ #ifdef OS_WIN
will not be
annotated.shell gclient sync
).