From a7598bd76a8707ab39eb844f2ed7473b01b3ff13 Mon Sep 17 00:00:00 2001 From: "Yuanyao (YY) Zhong" Date: Wed, 19 Jan 2022 14:44:29 -0500 Subject: [PATCH 1/5] Add tracing instructions in ESP32 README.md --- config/esp32/components/chip/component.mk | 1 + examples/all-clusters-app/esp32/README.md | 14 ++++++++++++++ src/trace/BUILD.gn | 9 +++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) 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..a369e3142eae46 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..7b1cbfef0535a4 100644 --- a/src/trace/BUILD.gn +++ b/src/trace/BUILD.gn @@ -18,11 +18,16 @@ declare_args() { chip_build_pw_trace_lib = false } +config("config") { + defines = [ + "PW_TRACE_BACKEND_SET=1", + ] +} + 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" ] } } From 1fd6debb6f18d68d54c94572e0b9504d42961d2f Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 19 Jan 2022 19:47:10 +0000 Subject: [PATCH 2/5] Restyled by gn --- src/trace/BUILD.gn | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/trace/BUILD.gn b/src/trace/BUILD.gn index 7b1cbfef0535a4..48d0d60b439d4b 100644 --- a/src/trace/BUILD.gn +++ b/src/trace/BUILD.gn @@ -19,9 +19,7 @@ declare_args() { } config("config") { - defines = [ - "PW_TRACE_BACKEND_SET=1", - ] + defines = [ "PW_TRACE_BACKEND_SET=1" ] } source_set("trace") { From cbff957d765602f8ea00e683efcf358afb13ea04 Mon Sep 17 00:00:00 2001 From: "Restyled.io" Date: Wed, 19 Jan 2022 19:47:12 +0000 Subject: [PATCH 3/5] Restyled by prettier-markdown --- examples/all-clusters-app/esp32/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/all-clusters-app/esp32/README.md b/examples/all-clusters-app/esp32/README.md index a369e3142eae46..cfb88c5606f70d 100644 --- a/examples/all-clusters-app/esp32/README.md +++ b/examples/all-clusters-app/esp32/README.md @@ -299,8 +299,9 @@ From within the console you can then invoke rpcs: ## 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). +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. @@ -308,4 +309,3 @@ 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 ``` - From 64e4b2e9544205c6d90c2c7e3a01b24d9b52e435 Mon Sep 17 00:00:00 2001 From: "Yuanyao (YY) Zhong" Date: Wed, 19 Jan 2022 16:08:37 -0500 Subject: [PATCH 4/5] Add "tokenized" to wordlist.txt --- .github/.wordlist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/.wordlist.txt b/.github/.wordlist.txt index d7f33d37231f92..e68ca8e80a9185 100644 --- a/.github/.wordlist.txt +++ b/.github/.wordlist.txt @@ -988,6 +988,7 @@ TLV tmp tngvndl TODO +tokenized toolchain toolchains topologies From b54ac2b9d47b16945e5b3bd791cb3c312a07a78a Mon Sep 17 00:00:00 2001 From: "Yuanyao (YY) Zhong" Date: Wed, 19 Jan 2022 17:38:14 -0500 Subject: [PATCH 5/5] Change in src/trace/BUILD.gn file for PW_TRACE_BACKEND_SET flag --- src/trace/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trace/BUILD.gn b/src/trace/BUILD.gn index 48d0d60b439d4b..209909432dc0bd 100644 --- a/src/trace/BUILD.gn +++ b/src/trace/BUILD.gn @@ -19,7 +19,7 @@ declare_args() { } config("config") { - defines = [ "PW_TRACE_BACKEND_SET=1" ] + defines = [ "PW_TRACE_BACKEND_SET" ] } source_set("trace") {