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


##########
include/nuttx/sched_note.h:
##########
@@ -119,6 +119,11 @@
   memset((s), 0, sizeof(struct note_filter_tag_s));
 #endif
 
+#define NOTE_BEGINEX_EVENT 0
+#define NOTE_ENDEX_EVENT 1
+#define NOTE_MARK_EVENT 2
+#define NOTE_COUNTER_EVENT 3
+
 #ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP

Review Comment:
   lt's remove "#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP/#else/#endif" since 
sched_note_xxx_ip already provide the dummy implementation



##########
include/nuttx/sched_note.h:
##########
@@ -119,6 +119,11 @@
   memset((s), 0, sizeof(struct note_filter_tag_s));
 #endif
 
+#define NOTE_BEGINEX_EVENT 0

Review Comment:
   ```
   #define NOTE_EVENT_BEGIN   0
   #define NOTE_EVENT_END     1
   #define NOTE_EVENT_MARK    2
   #define NOTE_EVENT_COUNTER 3
   ```



##########
include/nuttx/sched_note.h:
##########
@@ -441,6 +456,12 @@ struct note_binary_s
 #define SIZEOF_NOTE_BINARY(n) (sizeof(struct note_binary_s) + \
                                ((n) - 1) * sizeof(uint8_t))
 
+struct note_counter_s

Review Comment:
   move to soure file and change to:
   ```
   struct note_counter_s
   {
       unsigned long value;
       char name[1];
   };
   ```



##########
include/nuttx/sched_note.h:
##########
@@ -136,14 +141,24 @@
           sched_note_bprintf_ip(tag, SCHED_NOTE_IP, event, \
                                 fmt, ##__VA_ARGS__)
 #  define sched_note_beginex(tag, str) \
-          sched_note_printf_ip(tag, SCHED_NOTE_IP, "B|%d|%s", _SCHED_GETTID(), 
str)
+          sched_note_dump_ip(tag, SCHED_NOTE_IP, NOTE_BEGINEX_EVENT, \

Review Comment:
   let's call sched_note_dump instead sched_note_dump_ip



##########
include/nuttx/sched_note.h:
##########
@@ -136,14 +141,24 @@
           sched_note_bprintf_ip(tag, SCHED_NOTE_IP, event, \
                                 fmt, ##__VA_ARGS__)
 #  define sched_note_beginex(tag, str) \
-          sched_note_printf_ip(tag, SCHED_NOTE_IP, "B|%d|%s", _SCHED_GETTID(), 
str)
+          sched_note_dump_ip(tag, SCHED_NOTE_IP, NOTE_BEGINEX_EVENT, \
+                             str, strlen(str))
 #  define sched_note_endex(tag, str) \
-          sched_note_printf_ip(tag, SCHED_NOTE_IP, "E|%d|%s", _SCHED_GETTID(), 
str)
+          sched_note_dump_ip(tag, SCHED_NOTE_IP, NOTE_ENDEX_EVENT, \
+                             str, strlen(str))
 #  define sched_note_mark(tag, str) \
-          sched_note_printf_ip(tag, SCHED_NOTE_IP, "I|%d|%s", _SCHED_GETTID(), 
str)
+          sched_note_dump_ip(tag, SCHED_NOTE_IP, NOTE_MARK_EVENT, \
+                             str, strlen(str))
 #  define sched_note_counter(tag, name, value) \
-          sched_note_printf_ip(tag, SCHED_NOTE_IP, "C|%d|%s|%" PRId32, \
-                               _SCHED_GETTID(), name, value)
+          do \
+            { \
+              struct note_counter_s _counter_ = \
+                { \
+                  name, value \

Review Comment:
   name may disappear in noteram_dump_one, let's change to:
   ```
   #define sched_note_counter(tag, name, value) \
                sched_note_bprintf(tag, NOTE_EVENT_COUNTER, "%lx%s", (unsigned 
long)value, name)
   ```
   and implement %s inside sched_note_vbprintf.



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