xiaoxiang781216 commented on code in PR #7841:
URL: https://github.com/apache/nuttx/pull/7841#discussion_r1045221325


##########
include/nuttx/sched_note.h:
##########
@@ -448,6 +498,24 @@ extern "C"
 #define EXTERN extern
 #endif
 
+/****************************************************************************
+ * Name: sched_note_channel_register
+ *
+ * Description:
+ *   Add sched_note new channel
+ *
+ * Input Parameters:
+ *   channel    - The channel
+ *   name       - The name
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+int sched_note_channel_register(FAR struct note_channels_s *channel,

Review Comment:
   ```suggestion
   int sched_note_register(FAR struct sched_note_s *priv,
   ```



##########
include/nuttx/sched_note.h:
##########
@@ -435,6 +435,56 @@ struct note_filter_irq_s
 
 #endif /* CONFIG_SCHED_INSTRUMENTATION_FILTER */
 
+struct sched_note_ops_s
+{
+  void (*start)(FAR void *priv, FAR struct tcb_s *tcb);
+  void (*stop)(FAR void *priv, FAR struct tcb_s *tcb);
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SWITCH
+  void (*suspend)(FAR void *priv, FAR struct tcb_s *tcb);
+  void (*resume)(FAR void *priv, FAR struct tcb_s *tcb);
+#ifdef CONFIG_SMP
+  void (*cpu_start)(FAR void *priv, FAR struct tcb_s *tcb, int cpu);
+  void (*cpu_started)(FAR void *priv, FAR struct tcb_s *tcb);
+  void (*cpu_pause)(FAR void *priv, FAR struct tcb_s *tcb, int cpu);
+  void (*cpu_paused)(FAR void *priv, FAR struct tcb_s *tcb);
+  void (*cpu_resume)(FAR void *priv, FAR struct tcb_s *tcb, int cpu);
+  void (*cpu_resumed)(FAR void *priv, FAR struct tcb_s *tcb);
+#endif
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
+  void (*premption)(FAR void *priv, FAR struct tcb_s *tcb, bool locked);
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION
+  void (*csection)(FAR void *priv, FAR struct tcb_s *tcb, bool enter);
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS
+  void (*spinlock)(FAR void *priv, FAR struct tcb_s *tcb,
+                   FAR volatile void *spinlock, int type);
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+  void (*syscall_enter)(FAR void *priv, int nr);
+  void (*syscall_leave)(FAR void *priv, int nr);
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER
+  void (*irqhandler)(FAR void *priv, int irq, FAR void *handler, bool enter);
+#endif
+#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP
+  void (*write)(FAR void *priv, FAR const void *note, size_t notelen);
+#endif
+};
+
+struct note_channels_s

Review Comment:
   let's follow syslog_channel_s style:
   ```
   struct sched_note_s
   {
     /* Sched note operations */
   
     FAR const struct sched_note_ops_s *ops;
   
     /* Implementation specific logic may follow */
   };
   ```



##########
drivers/note/sched_note.c:
##########
@@ -1307,3 +1560,30 @@ void sched_note_filter_irq(struct note_filter_irq_s 
*oldf,
 #endif
 
 #endif /* CONFIG_SCHED_INSTRUMENTATION_FILTER */
+
+/****************************************************************************
+ * Name: sched_note_channel_register
+ ****************************************************************************/
+
+int sched_note_channel_register(FAR struct note_channels_s *channel,
+                                FAR const char *name)
+{
+  int i;
+  DEBUGASSERT(channel);
+
+  for (i = 0; i < CONFIG_SCHED_NOTE_CHANNELS_MAX; i++)
+    {
+      if (g_note_channel_list[i] == NULL)
+        {
+          g_note_channel_list[i] = channel;
+          break;

Review Comment:
   return OK;



##########
drivers/note/sched_note.c:
##########
@@ -1307,3 +1560,30 @@ void sched_note_filter_irq(struct note_filter_irq_s 
*oldf,
 #endif
 
 #endif /* CONFIG_SCHED_INSTRUMENTATION_FILTER */
+
+/****************************************************************************
+ * Name: sched_note_channel_register
+ ****************************************************************************/
+
+int sched_note_channel_register(FAR struct note_channels_s *channel,
+                                FAR const char *name)
+{
+  int i;
+  DEBUGASSERT(channel);
+
+  for (i = 0; i < CONFIG_SCHED_NOTE_CHANNELS_MAX; i++)
+    {
+      if (g_note_channel_list[i] == NULL)
+        {
+          g_note_channel_list[i] = channel;
+          break;
+        }
+    }
+
+  if (i == CONFIG_SCHED_NOTE_CHANNELS_MAX)

Review Comment:
   return -ENOMEM;



##########
include/nuttx/sched_note.h:
##########
@@ -435,6 +435,56 @@ struct note_filter_irq_s
 
 #endif /* CONFIG_SCHED_INSTRUMENTATION_FILTER */
 
+struct sched_note_ops_s
+{
+  void (*start)(FAR void *priv, FAR struct tcb_s *tcb);

Review Comment:
   ```suggestion
     CODE void (*start)(FAR struct sched_note_s *priv, FAR struct tcb_s *tcb);
   ```



-- 
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.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

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

Reply via email to