mirror of https://github.com/zmkfirmware/zmk.git
feat: Add RPC thread analysis support.
This commit is contained in:
parent
17f0a4d307
commit
21e1b2acad
|
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
#include <zephyr/init.h>
|
#include <zephyr/init.h>
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
|
#include <zephyr/debug/thread_analyzer.h>
|
||||||
#include <zephyr/logging/log.h>
|
#include <zephyr/logging/log.h>
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(zmk_studio, CONFIG_ZMK_STUDIO_LOG_LEVEL);
|
LOG_MODULE_REGISTER(zmk_studio, CONFIG_ZMK_STUDIO_LOG_LEVEL);
|
||||||
|
|
@ -215,6 +216,9 @@ static void rpc_main(void) {
|
||||||
for (;;) {
|
for (;;) {
|
||||||
pb_istream_t stream = pb_istream_for_rx_ring_buf();
|
pb_istream_t stream = pb_istream_for_rx_ring_buf();
|
||||||
zmk_studio_Request req = zmk_studio_Request_init_zero;
|
zmk_studio_Request req = zmk_studio_Request_init_zero;
|
||||||
|
#if IS_ENABLED(CONFIG_THREAD_ANALYZER)
|
||||||
|
thread_analyzer_print();
|
||||||
|
#endif // IS_ENABLED(CONFIG_THREAD_ANALYZER)
|
||||||
bool status = pb_decode(&stream, &zmk_studio_Request_msg, &req);
|
bool status = pb_decode(&stream, &zmk_studio_Request_msg, &req);
|
||||||
|
|
||||||
rpc_framing_state = FRAMING_STATE_IDLE;
|
rpc_framing_state = FRAMING_STATE_IDLE;
|
||||||
|
|
@ -223,6 +227,9 @@ static void rpc_main(void) {
|
||||||
zmk_studio_Response resp = handle_request(&req);
|
zmk_studio_Response resp = handle_request(&req);
|
||||||
|
|
||||||
int err = send_response(&resp);
|
int err = send_response(&resp);
|
||||||
|
#if IS_ENABLED(CONFIG_THREAD_ANALYZER)
|
||||||
|
thread_analyzer_print();
|
||||||
|
#endif // IS_ENABLED(CONFIG_THREAD_ANALYZER)
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
LOG_ERR("Failed to send the RPC response %d", err);
|
LOG_ERR("Failed to send the RPC response %d", err);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue