pw_thread: Make snapshot logs debug level
Changes logs during snapshot capture to be at debug level as they're
quite verbose and can quickly flood log buffers.
No-Docs-Update-Reason: Log level tuning
Change-Id: If8dc03d6aaba919cf3c01504a2df66abdd2daeee
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/56927
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Pigweed-Auto-Submit: Armando Montanez <amontanez@google.com>
diff --git a/pw_thread/snapshot.cc b/pw_thread/snapshot.cc
index 7af31d7..32fe259 100644
--- a/pw_thread/snapshot.cc
+++ b/pw_thread/snapshot.cc
@@ -31,16 +31,16 @@
encoder.WriteStackStartPointer(stack.stack_high_addr);
encoder.WriteStackEndPointer(stack.stack_low_addr);
encoder.WriteStackPointer(stack.stack_pointer);
- PW_LOG_INFO("Active stack: 0x%08x-0x%08x (%ld bytes)",
- stack.stack_high_addr,
- stack.stack_pointer,
- static_cast<long>(stack.stack_high_addr) -
- static_cast<long>(stack.stack_pointer));
- PW_LOG_INFO("Stack Limits: 0x%08x-0x%08x (%ld bytes)",
- stack.stack_low_addr,
- stack.stack_high_addr,
- static_cast<long>(stack.stack_high_addr) -
- static_cast<long>(stack.stack_low_addr));
+ PW_LOG_DEBUG("Active stack: 0x%08x-0x%08x (%ld bytes)",
+ stack.stack_high_addr,
+ stack.stack_pointer,
+ static_cast<long>(stack.stack_high_addr) -
+ static_cast<long>(stack.stack_pointer));
+ PW_LOG_DEBUG("Stack Limits: 0x%08x-0x%08x (%ld bytes)",
+ stack.stack_low_addr,
+ stack.stack_high_addr,
+ static_cast<long>(stack.stack_high_addr) -
+ static_cast<long>(stack.stack_low_addr));
if (stack.stack_pointer > stack.stack_high_addr) {
PW_LOG_ERROR("%s's stack underflowed by %lu bytes",
diff --git a/pw_thread_embos/snapshot.cc b/pw_thread_embos/snapshot.cc
index 0ce1ff6..e4fee0a 100644
--- a/pw_thread_embos/snapshot.cc
+++ b/pw_thread_embos/snapshot.cc
@@ -35,7 +35,7 @@
void CaptureThreadState(const OS_TASK& thread, Thread::StreamEncoder& encoder) {
if (ThreadIsRunning(thread)) {
- PW_LOG_INFO("Thread state: RUNNING");
+ PW_LOG_DEBUG("Thread state: RUNNING");
encoder.WriteState(ThreadState::Enum::RUNNING);
return;
}
@@ -56,13 +56,13 @@
#endif // OS_VERSION_GENERIC < 42200 || OS_VERSION_GENERIC > 50600
if ((thread.Stat & 0x3) != 0) {
- PW_LOG_INFO("Thread state: SUSPENDED");
+ PW_LOG_DEBUG("Thread state: SUSPENDED");
encoder.WriteState(ThreadState::Enum::SUSPENDED);
} else if ((thread.Stat & 0xf8) == 0) {
- PW_LOG_INFO("Thread state: READY");
+ PW_LOG_DEBUG("Thread state: READY");
encoder.WriteState(ThreadState::Enum::READY);
} else {
- PW_LOG_INFO("Thread state: BLOCKED");
+ PW_LOG_DEBUG("Thread state: BLOCKED");
encoder.WriteState(ThreadState::Enum::BLOCKED);
}
}
@@ -107,10 +107,10 @@
Thread::StreamEncoder& encoder,
ProcessThreadStackCallback& thread_stack_callback) {
#if OS_TRACKNAME
- PW_LOG_INFO("Capturing thread info for %s", thread.Name);
+ PW_LOG_DEBUG("Capturing thread info for %s", thread.Name);
encoder.WriteName(std::as_bytes(std::span(std::string_view(thread.Name))));
#else
- PW_LOG_INFO("Capturing thread info for thread at 0x%08x", &thread);
+ PW_LOG_DEBUG("Capturing thread info for thread at 0x%08x", &thread);
#endif // OS_TRACKNAME
CaptureThreadState(thread, encoder);
@@ -132,7 +132,7 @@
return SnapshotStack(thread_ctx, encoder, thread_stack_callback);
#else
- PW_LOG_INFO("Stack pointer: 0x%08x", running_thread_stack_pointer);
+ PW_LOG_DEBUG("Stack pointer: 0x%08x", running_thread_stack_pointer);
encoder.WriteStackPointer(reinterpret_cast<uintptr_t>(
ThreadIsRunning(thread) ? running_thread_stack_pointer : thread.pStack));
return encoder.status();
diff --git a/pw_thread_freertos/snapshot.cc b/pw_thread_freertos/snapshot.cc
index dbde591..892c4b0 100644
--- a/pw_thread_freertos/snapshot.cc
+++ b/pw_thread_freertos/snapshot.cc
@@ -34,33 +34,33 @@
Thread::StreamEncoder& encoder) {
switch (thread_state) {
case eRunning:
- PW_LOG_INFO("Thread state: RUNNING");
+ PW_LOG_DEBUG("Thread state: RUNNING");
encoder.WriteState(ThreadState::Enum::RUNNING);
return;
case eReady:
- PW_LOG_INFO("Thread state: READY");
+ PW_LOG_DEBUG("Thread state: READY");
encoder.WriteState(ThreadState::Enum::READY);
return;
case eBlocked:
- PW_LOG_INFO("Thread state: BLOCKED");
+ PW_LOG_DEBUG("Thread state: BLOCKED");
encoder.WriteState(ThreadState::Enum::BLOCKED);
return;
case eSuspended:
- PW_LOG_INFO("Thread state: SUSPENDED");
+ PW_LOG_DEBUG("Thread state: SUSPENDED");
encoder.WriteState(ThreadState::Enum::SUSPENDED);
return;
case eDeleted:
- PW_LOG_INFO("Thread state: INACTIVE");
+ PW_LOG_DEBUG("Thread state: INACTIVE");
encoder.WriteState(ThreadState::Enum::INACTIVE);
return;
case eInvalid:
default:
- PW_LOG_INFO("Thread state: UNKNOWN");
+ PW_LOG_DEBUG("Thread state: UNKNOWN");
encoder.WriteState(ThreadState::Enum::UNKNOWN);
return;
}
@@ -108,7 +108,7 @@
ProcessThreadStackCallback& thread_stack_callback) {
const tskTCB& tcb = *reinterpret_cast<tskTCB*>(thread);
- PW_LOG_INFO("Capturing thread info for %s", tcb.pcTaskName);
+ PW_LOG_DEBUG("Capturing thread info for %s", tcb.pcTaskName);
encoder.WriteName(std::as_bytes(std::span(std::string_view(tcb.pcTaskName))));
CaptureThreadState(thread_state, encoder);
diff --git a/pw_thread_threadx/snapshot.cc b/pw_thread_threadx/snapshot.cc
index 65cdd1f..90bba5c 100644
--- a/pw_thread_threadx/snapshot.cc
+++ b/pw_thread_threadx/snapshot.cc
@@ -11,6 +11,7 @@
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
// License for the specific language governing permissions and limitations under
// the License.
+
#include "pw_thread_threadx/snapshot.h"
#include <string_view>
@@ -39,24 +40,24 @@
void CaptureThreadState(const TX_THREAD& thread,
Thread::StreamEncoder& encoder) {
if (ThreadIsRunning(thread)) {
- PW_LOG_INFO("Thread state: RUNNING");
+ PW_LOG_DEBUG("Thread state: RUNNING");
encoder.WriteState(ThreadState::Enum::RUNNING);
return;
}
switch (thread.tx_thread_state) {
case TX_READY:
- PW_LOG_INFO("Thread state: READY");
+ PW_LOG_DEBUG("Thread state: READY");
encoder.WriteState(ThreadState::Enum::READY);
break;
case TX_COMPLETED:
case TX_TERMINATED:
- PW_LOG_INFO("Thread state: INACTIVE");
+ PW_LOG_DEBUG("Thread state: INACTIVE");
encoder.WriteState(ThreadState::Enum::INACTIVE);
break;
case TX_SUSPENDED:
case TX_SLEEP:
- PW_LOG_INFO("Thread state: SUSPENDED");
+ PW_LOG_DEBUG("Thread state: SUSPENDED");
encoder.WriteState(ThreadState::Enum::SUSPENDED);
break;
case TX_QUEUE_SUSP:
@@ -68,11 +69,11 @@
case TX_FILE:
case TX_TCP_IP:
case TX_MUTEX_SUSP:
- PW_LOG_INFO("Thread state: BLOCKED");
+ PW_LOG_DEBUG("Thread state: BLOCKED");
encoder.WriteState(ThreadState::Enum::BLOCKED);
break;
default:
- PW_LOG_INFO("Thread state: UNKNOWN");
+ PW_LOG_DEBUG("Thread state: UNKNOWN");
encoder.WriteState(ThreadState::Enum::UNKNOWN);
}
}
@@ -115,7 +116,7 @@
void* running_thread_stack_pointer,
Thread::StreamEncoder& encoder,
ProcessThreadStackCallback& thread_stack_callback) {
- PW_LOG_INFO("Capturing thread info for %s", thread.tx_thread_name);
+ PW_LOG_DEBUG("Capturing thread info for %s", thread.tx_thread_name);
encoder.WriteName(
std::as_bytes(std::span(std::string_view(thread.tx_thread_name))));