You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2020/11/03 13:58:59 UTC

[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #2142: Add task name record for task trace

xiaoxiang781216 commented on a change in pull request #2142:
URL: https://github.com/apache/incubator-nuttx/pull/2142#discussion_r515808424



##########
File path: drivers/note/noteram_driver.c
##########
@@ -107,6 +132,183 @@ static volatile spinlock_t g_noteram_lock;
  * Private Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: noteram_find_taskname
+ *
+ * Description:
+ *   Find task name info corresponding to the specified PID
+ *
+ * Input Parameters:
+ *   PID - Task ID
+ *
+ * Returned Value:
+ *   Pointer to the task name info
+ *   If the corresponding info doesn't exist in the buffer, NULL is returned.
+ *
+ ****************************************************************************/
+
+#if CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE > 0
+static FAR struct noteram_taskname_info_s *noteram_find_taskname(pid_t pid)
+{
+  int n;
+  FAR struct noteram_taskname_info_s *ti;
+
+  for (n = 0; n < g_noteram_taskname.buffer_used; )
+    {
+      ti = (FAR struct noteram_taskname_info_s *)
+            &g_noteram_taskname.buffer[n];
+      if (ti->pid[0] + (ti->pid[1] << 8) == pid)
+        {
+          return ti;
+        }
+
+      n += ti->size;
+    }
+
+  return NULL;
+}
+#endif
+
+/****************************************************************************
+ * Name: noteram_record_taskname
+ *
+ * Description:
+ *   Record the task name info of the current task
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE > 0
+static void noteram_record_taskname(void)

Review comment:
       Yes, you are right. I forget this special case.

##########
File path: drivers/note/noteram_driver.c
##########
@@ -107,6 +132,183 @@ static volatile spinlock_t g_noteram_lock;
  * Private Functions
  ****************************************************************************/
 
+/****************************************************************************
+ * Name: noteram_find_taskname
+ *
+ * Description:
+ *   Find task name info corresponding to the specified PID
+ *
+ * Input Parameters:
+ *   PID - Task ID
+ *
+ * Returned Value:
+ *   Pointer to the task name info
+ *   If the corresponding info doesn't exist in the buffer, NULL is returned.
+ *
+ ****************************************************************************/
+
+#if CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE > 0
+static FAR struct noteram_taskname_info_s *noteram_find_taskname(pid_t pid)
+{
+  int n;
+  FAR struct noteram_taskname_info_s *ti;
+
+  for (n = 0; n < g_noteram_taskname.buffer_used; )
+    {
+      ti = (FAR struct noteram_taskname_info_s *)
+            &g_noteram_taskname.buffer[n];
+      if (ti->pid[0] + (ti->pid[1] << 8) == pid)
+        {
+          return ti;
+        }
+
+      n += ti->size;
+    }
+
+  return NULL;
+}
+#endif
+
+/****************************************************************************
+ * Name: noteram_record_taskname
+ *
+ * Description:
+ *   Record the task name info of the current task
+ *
+ * Input Parameters:
+ *   None
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#if CONFIG_DRIVER_NOTERAM_TASKNAME_BUFSIZE > 0
+static void noteram_record_taskname(void)

Review comment:
       Yes, you are right. I forget this special case, but geting the live task name could patch this case.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org