Skip to content

Commit

Permalink
Add tracing instructions in ESP32 README.md (project-chip#13722)
Browse files Browse the repository at this point in the history
* Add tracing instructions in ESP32 README.md

* Restyled by gn

* Restyled by prettier-markdown

* Add "tokenized" to wordlist.txt

* Change in src/trace/BUILD.gn file for PW_TRACE_BACKEND_SET flag

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and selissia committed Jan 28, 2022
1 parent 578e50e commit f0975ea
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/.wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ TLV
tmp
tngvndl
TODO
tokenized
toolchain
toolchains
topologies
Expand Down
1 change: 1 addition & 0 deletions config/esp32/components/chip/component.mk
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ ifeq ($(is_debug),false)
endif
if [[ "$(CONFIG_ENABLE_PW_RPC)" = "y" ]]; then \
echo "chip_build_pw_rpc_lib = true" >> $(OUTPUT_DIR)/args.gn ;\
echo "chip_build_pw_trace_lib = true" >> $(OUTPUT_DIR)/args.gn ;\
echo "remove_default_configs = [\"//third_party/connectedhomeip/third_party/pigweed/repo/pw_build:cpp17\"]" >> $(OUTPUT_DIR)/args.gn ;\
echo "pw_log_BACKEND = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_log_basic\"" >> $(OUTPUT_DIR)/args.gn ;\
echo "pw_assert_BACKEND = \"//third_party/connectedhomeip/third_party/pigweed/repo/pw_assert_log\"" >> $(OUTPUT_DIR)/args.gn ;\
Expand Down
14 changes: 14 additions & 0 deletions examples/all-clusters-app/esp32/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ control.
- [Flashing app using script](#flashing-app-using-script)
- [Note](#note)
- [Using the RPC console](#using-the-rpc-console)
- [Device Tracing](#device-tracing)

---

Expand Down Expand Up @@ -295,3 +296,16 @@ From within the console you can then invoke rpcs:

rpcs.chip.rpc.Lighting.Get()
rpcs.chip.rpc.Lighting.Set(on=True, level=128, color=protos.chip.rpc.LightingColor(hue=5, saturation=5))

## Device Tracing

Device tracing is available to analyze the device performance. To turn on
tracing, build with RPC enabled. See
[Using the RPC console](#using-the-rpc-console).

Obtain tracing json file.

```
$ ./{PIGWEED_REPO}/pw_trace_tokenized/py/pw_trace_tokenized/get_trace.py -d {PORT} -o {OUTPUT_FILE} \
-t {ELF_FILE} {PIGWEED_REPO}/pw_trace_tokenized/pw_trace_protos/trace_rpc.proto
```
7 changes: 5 additions & 2 deletions src/trace/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,14 @@ declare_args() {
chip_build_pw_trace_lib = false
}

config("config") {
defines = [ "PW_TRACE_BACKEND_SET" ]
}

source_set("trace") {
sources = [ "trace.h" ]

if (chip_build_pw_trace_lib) {
cflags = [ "-DPW_TRACE_BACKEND_SET=1" ]
public_configs = [ ":config" ]
public_deps = [ "${dir_pigweed}/pw_trace" ]
}
}

0 comments on commit f0975ea

Please sign in to comment.