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



##########
File path: drivers/segger/note_sysview.c
##########
@@ -310,6 +366,54 @@ void sched_note_irqhandler(int irq, FAR void *handler, 
bool enter)
 }
 #endif
 
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+void sched_note_syscall_enter(int nr, int argc, ...)
+{
+  if (sysview_isenabled_syscall(nr) == 0)

Review comment:
       let's sub nr by CONFIG_SYS_RESERVED at the beginning to ensure all place 
use the correct value.

##########
File path: boards/sim/sim/sim/configs/segger/defconfig
##########
@@ -62,6 +62,7 @@ CONFIG_SCHED_HAVE_PARENT=y
 CONFIG_SCHED_HPWORK=y
 CONFIG_SCHED_INSTRUMENTATION=y
 CONFIG_SCHED_INSTRUMENTATION_FILTER=y
+CONFIG_SCHED_INSTRUMENTATION_SYSCALL=y

Review comment:
       let's modify 
https://github.com/apache/incubator-nuttx/blob/master/tools/ci/testlist/sim-02.dat
 to remove segger from macOS build.

##########
File path: drivers/segger/note_sysview.c
##########
@@ -155,11 +159,24 @@ static bool sysview_isenabled(void)
     }
 #endif
 
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+  /* Use the Syscall "0" to identify whether the syscall is enabled,

Review comment:
       but how to handle if nobody call syscall#0?

##########
File path: drivers/segger/note_sysview.c
##########
@@ -310,6 +366,54 @@ void sched_note_irqhandler(int irq, FAR void *handler, 
bool enter)
 }
 #endif
 
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+void sched_note_syscall_enter(int nr, int argc, ...)
+{
+  if (sysview_isenabled_syscall(nr) == 0)
+    {
+      return;
+    }
+
+  /* Set the name marker if the current syscall nr is not active */
+
+  if (NOTE_FILTER_SYSCALLMASK_ISSET(nr, &g_sysview.syscall_marker) == 0)
+    {
+      /* Set the name marker */
+
+      SEGGER_SYSVIEW_NameMarker(nr, g_funcnames[nr]);
+
+      /* Mark the syscall active */
+
+      NOTE_FILTER_SYSCALLMASK_SET(nr, &g_sysview.syscall_marker);
+
+      /* Use the Syscall "0" to identify whether the syscall is enabled,
+       * if the host tool is closed abnormally, use this bit to clear
+       * the active set.
+       */
+
+      if (NOTE_FILTER_SYSCALLMASK_ISSET(0, &g_sysview.syscall_marker) == 0)
+        {
+          NOTE_FILTER_SYSCALLMASK_SET(0, &g_sysview.syscall_marker);
+        }
+    }
+
+  SEGGER_SYSVIEW_MarkStart(nr);
+}
+
+void sched_note_syscall_leave(int nr, uintptr_t result)
+{
+  if (sysview_isenabled_syscall(nr) == 0)

Review comment:
       ditto for nr




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