From bdab6c5f40ee1ef2659249d45a336665e4a04b9d Mon Sep 17 00:00:00 2001 From: Yuanyao Zhong <82843247+yyzhong-g@users.noreply.github.com> Date: Thu, 20 Jan 2022 18:59:16 -0500 Subject: [PATCH] Add tracing instructions in ESP32 README.md (#13722) * 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 --- .github/.wordlist.txt | 1 + config/esp32/components/chip/component.mk | 1 + examples/all-clusters-app/esp32/README.md | 14 ++++++++++++++ src/trace/BUILD.gn | 7 +++++-- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index c811299aae330f..9886a40b4d99a9 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -993,6 +993,7 @@ TLV tmp tngvndl TODO +tokenized toolchain toolchains topologies diff --git a/config/esp32/components/chip/component.mk b/config/esp32/components/chip/component.mk index 6b8714b1db620e..61ab9100fa78e7 100644 --- a/config/esp32/components/chip/component.mk +++ b/config/esp32/components/chip/component.mk @@ -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 ;\ diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index 1f4ca1ca5a630e..cfb88c5606f70d 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -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) --- @@ -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 +``` diff --git a/src/trace/BUILD.gn b/src/trace/BUILD.gn index 546107ad45ce67..209909432dc0bd 100644 --- a/src/trace/BUILD.gn +++ b/src/trace/BUILD.gn @@ -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" ] } }