You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/01/04 12:53:16 UTC
[incubator-nuttx-apps] branch master updated: note main: system/sched_note add output of string and binary
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 0c79d57 note main: system/sched_note add output of string and binary
0c79d57 is described below
commit 0c79d57f123478b0002d3860c41a2b9993cda192
Author: zhanghu6 <zh...@xiaomi.com>
AuthorDate: Thu Dec 30 18:53:56 2021 +0800
note main: system/sched_note add output of string and binary
ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
case NOTE_DUMP_STRING:
case NOTE_DUMP_BINARY:
endif
---
system/sched_note/note_main.c | 64 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 64 insertions(+)
diff --git a/system/sched_note/note_main.c b/system/sched_note/note_main.c
index 948925c..817a9f1 100644
--- a/system/sched_note/note_main.c
+++ b/system/sched_note/note_main.c
@@ -60,6 +60,7 @@ static uint8_t g_note_buffer[CONFIG_SYSTEM_NOTE_BUFFERSIZE];
/* Names of task/thread states */
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
static FAR const char *g_statenames[] =
{
"Invalid",
@@ -76,6 +77,7 @@ static FAR const char *g_statenames[] =
};
#define NSTATES (sizeof(g_statenames)/sizeof(FAR const char *))
+#endif
/************************************************************************************
* Private Functions
@@ -710,6 +712,68 @@ static void dump_notes(size_t nread)
break;
#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
+ case NOTE_DUMP_STRING:
+ {
+ FAR struct note_string_s *note_string =
+ (FAR struct note_string_s *)note;
+
+ if (note->nc_length < sizeof(struct note_string_s))
+ {
+ syslog(LOG_INFO,
+ "ERROR: note too small for string note: %d\n",
+ note->nc_length);
+ return;
+ }
+
+ syslog_time(LOG_INFO,
+ "Task %u priority %u, string:%s\n",
+ (unsigned int)pid,
+ (unsigned int)note->nc_priority,
+ note_string->nst_data);
+ }
+ break;
+
+ case NOTE_DUMP_BINARY:
+ {
+ FAR struct note_binary_s *note_binary =
+ (FAR struct note_binary_s *)note;
+ char out[1280];
+ int count;
+ int ret = 0;
+ int i;
+
+ count = note->nc_length - sizeof(struct note_binary_s) + 1;
+
+ if (count < 0)
+ {
+ syslog(LOG_INFO,
+ "ERROR: note too small for binary note: %d\n",
+ note->nc_length);
+ return;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ ret += sprintf(&out[ret], " 0x%x", note_binary->nbi_data[i]);
+ }
+
+ syslog_time(LOG_INFO,
+ "Task %u priority %u, binary:module=%c%c%c%c "
+ "event=%u count=%u%s\n",
+ (unsigned int)pid,
+ (unsigned int)note->nc_priority,
+ note_binary->nbi_module[0],
+ note_binary->nbi_module[1],
+ note_binary->nbi_module[2],
+ note_binary->nbi_module[3],
+ note_binary->nbi_event,
+ count,
+ out);
+ }
+ break;
+#endif
+
default:
syslog(LOG_INFO, "Unrecognized note type: %d\n", note->nc_type);
return;