Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

note enhance #14113

Merged
merged 13 commits into from
Oct 13, 2024
Merged

note enhance #14113

merged 13 commits into from
Oct 13, 2024

Conversation

Gary-Hobson
Copy link
Contributor

Summary

  1. note:support filter for each note channel
  2. drivers/note:add the api of sched_note_add
  3. noteram_driver.c:noteram_dump_printf function replaced with lib_bsprintf.
  4. drivers/note:add the poll function for noteram
  5. fix bugs

Impact

none

Testing

sim

@github-actions github-actions bot added the Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces. label Oct 11, 2024
Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

cuiziweizw and others added 13 commits October 12, 2024 20:52
avoid the instrument doesn't get registered in some case

Signed-off-by: cuiziwei <[email protected]>
Signed-off-by: yinshengkai <[email protected]>
note/note_driver.c:1405:11: runtime error: null pointer passed as argument 2, which is declared to never be null
    #0 0x33bf5cc in sched_note_event_ip note/note_driver.c:1405
    #1 0x33bfb57 in note_driver_instrument_enter note/note_initialize.c:55
    #2 0x347b084 in __cyg_profile_func_enter misc/lib_instrument.c:68
    #3 0x34179de in binder_initialize binder/binder.c:669
    #4 0x339a936 in drivers_initialize /home/cuiziwei/vela/happy/nuttx/drivers/drivers_initialize.c:242
    #5 0x335a179 in nx_start init/nx_start.c:632
    #6 0x32f755c in main sim/sim_head.c:180
    apache#7 0xf6821518  (/lib/i386-linux-gnu/libc.so.6+0x21518) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
    apache#8 0xf68215f2 in __libc_start_main (/lib/i386-linux-gnu/libc.so.6+0x215f2) (BuildId: 7f64b917aaa97b9680d8e44931bf7611c5a1f036)
    apache#9 0x32b401a in _start (/home/cuiziwei/vela/happy/nuttx/nuttx+0x32b401a) (BuildId: 33f8f7b361d44a008de87fea1bc970b22b48b700)

Signed-off-by: cuiziwei <[email protected]>
note/note_driver.c:639:21: warning: 'strlen' reading 1 or more bytes from a region of size 0 [-Wstringop-overread]
  639 |           namelen = strlen(tcb->name);
      |                     ^~~~~~~~~~~~~~~~~

Signed-off-by: cuiziwei <[email protected]>
Signed-off-by: wangmingrong <[email protected]>
…ntf.

open CONFIG_DRIVERS_NOTE_STRIP_FORMAT:
OUT:

NuttShell (NSH) NuttX-12.3.0
nsh> hello
nsh> trace dump
loop_task-1   [0]   0.001728177: sched_wakeup_new: comm=loop_task pid=1 target_cpu=0
Idle_Task-0   [0]   0.001745633: sched_wakeup_new: comm=Idle_Task pid=0 target_cpu=0
  hpwork-2   [0]   0.001791495: sched_wakeup_new: comm=hpwork pid=2 target_cpu=0
nsh_main-3   [0]   0.001814164: sched_wakeup_new: comm=nsh_main pid=3 target_cpu=0
   hello-4   [0]   2.583795447: sched_wakeup_new: comm=hello pid=4 target_cpu=0
   hello-4   [0]   2.583843399: tracing_mark_write:
 ###### start long args test!!!
   hello-4   [0]   2.583844088: tracing_mark_write: 0x48ebe0 97 19299 22155 4294967217 4294957304 4294945141 92.999900 9299.929993 92999299929992 18446743074409621624 61 254 429495799   hello-4   [0]   2.583845991: tracing_mark_write: 0x48ec20 qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvb>�/�L�p�J   hello-4   [0]   2.583847105: tracing_mark_write:
 ###### start long args test!!!
   trace-5   [0]   2.928625413: sched_wakeup_new: comm=trace pid=5 target_cpu=0
nsh>

close CONFIG_DRIVERS_NOTE_STRIP_FORMAT:

NuttShell (NSH) NuttX-12.3.0
nsh> hello
nsh> trace dump
loop_task-1   [0]   0.001607506: sched_wakeup_new: comm=loop_task pid=1 target_cpu=0
Idle_Task-0   [0]   0.001624549: sched_wakeup_new: comm=Idle_Task pid=0 target_cpu=0
  hpwork-2   [0]   0.001666256: sched_wakeup_new: comm=hpwork pid=2 target_cpu=0
nsh_main-3   [0]   0.001688556: sched_wakeup_new: comm=nsh_main pid=3 target_cpu=0
   hello-4   [0]   3.812630763: sched_wakeup_new: comm=hello pid=4 target_cpu=0
   hello-4   [0]   0.370899272: tracing_mark_write:
 ###### start NOTE_STRIP_FORMAT test!!!
   hello-4   [0]   0.370900260: tracing_mark_write:            uint8_t[97]:[97]
   hello-4   [0]   0.370900735: tracing_mark_write:           uint16_t[19299]:[19299]
   hello-4   [0]   0.370901155: tracing_mark_write:           uint32_t[22155]:[22155]
   hello-4   [0]   0.370901715: tracing_mark_write:              float[92.9999]:[92.999900]
   hello-4   [0]   0.370902196: tracing_mark_write:             double[9299.929992999299]:[9299.929993]
   hello-4   [0]   0.370902978: tracing_mark_write:             char[][qweretyuiopasdfghjklzxcvbnm]:[qweretyuiopasdfghjklzxcvbnm]
   hello-4   [0]   0.370904061: tracing_mark_write:           uint64_t[92999299929992]:[92999299929992]
   hello-4   [0]   0.370904554: tracing_mark_write:      unsigned char[254]:[254]
   hello-4   [0]   0.370904999: tracing_mark_write: unsigned short int[9299]:[9299]
   hello-4   [0]   0.370905435: tracing_mark_write:       unsigned int[9299992]:[9299992]
   hello-4   [0]   0.370905876: tracing_mark_write:      unsigned long[929992992]:[929992992]
   hello-4   [0]   0.370906402: tracing_mark_write: unsigned long long[9299929924]:[9299929924]
   hello-4   [0]   0.370906822: tracing_mark_write:
 ###### end test!!!
   hello-4   [0]   0.370908999: tracing_mark_write:
 ###### start long args test!!!
   hello-4   [0]   0.370909770: tracing_mark_write: 97 19299 22155 97 19299 22155 92.999900 9299.929993 92999299929992 92999299929992 254 254 9299 9299
   hello-4   [0]   0.370927340: tracing_mark_write: qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweretyuiopasdfghjklzxcvbnm qweret>��+�c�   hello-4   [0]   0.370928037: tracing_mark_write:
 ###### start long args test!!!
   trace-5   [0]   4.173395106: sched_wakeup_new: comm=trace pid=5 target_cpu=0
nsh>

test SRC:

\#include <nuttx/config.h>
\#include <nuttx/streams.h>
\#include <stdio.h>
\#include <syslog.h>
\#define TOSTR(str)   #str
\#define TONNAME(name) TOSTR(name)

\#define v_uint8_t    97
\#define v_uint16_t   19299
\#define v_uint32_t   22155
\#define v_int8_t     -79
\#define v_int16_t    -9992
\#define v_int32_t    -22155
\#define v_float      92.9999
\#define v_double     9299.929992999299
\#define v_char_arr   qweretyuiopasdfghjklzxcvbnm
\#define v_uint64_t   92999299929992
\#define v_int64_t    -999299929992
\#define v_char       61
\#define v_u_char     254
\#define v_s_int      -9299
\#define v_u_s_int    9299
\#define v_int        -9299991
\#define v_u_int      9299992
\#define v_long       -929992991
\#define v_u_long     929992992
\#define v_l_l        -929992993
\#define v_u_l_l      9299929924
\#define v_size_t     29299
\#define v_l_double   -9299.9299929912122464755474

int main(int argc, FAR char *argv[])
{
\#ifdef CONFIG_DRIVERS_NOTE_STRIP_FORMAT
  sched_note_printf(0, "\n ###### start long args test!!! \n");
  sched_note_printf(0, "%u %u %u %d %d %d %f %f %lu %ld %d %u %d %u",
                    v_uint8_t, v_uint16_t, v_uint32_t, v_int8_t, v_int16_t,
                    v_int32_t, v_float, v_double, v_uint64_t, v_int64_t,
                    v_char, v_u_char, v_s_int, v_u_s_int);

  sched_note_printf(0, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s",
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr));
  sched_note_printf(0, "\n ###### start long args test!!! \n");

\#else

  sched_note_printf(0, "\n ###### start NOTE_STRIP_FORMAT test!!! \n");
  sched_note_printf(0, "           uint8_t["TONNAME(v_uint8_t)"]:[%u]", v_uint8_t);
  sched_note_printf(0, "          uint16_t["TONNAME(v_uint16_t)"]:[%u]", v_uint16_t);
  sched_note_printf(0, "          uint32_t["TONNAME(v_uint32_t)"]:[%u]", v_uint32_t);
  sched_note_printf(0, "             float["TONNAME(v_float)"]:[%f]", v_float);
  sched_note_printf(0, "            double["TONNAME(v_double)"]:[%f]", v_double);
  sched_note_printf(0, "            char[]["TONNAME(v_char_arr)"]:[%.32s]", TONNAME(v_char_arr));
  sched_note_printf(0, "          uint64_t["TONNAME(v_uint64_t)"]:[%lu]", v_uint64_t);
  sched_note_printf(0, "     unsigned char["TONNAME(v_u_char)"]:[%u]", v_u_char);
  sched_note_printf(0, "unsigned short int["TONNAME(v_u_s_int)"]:[%u]", v_u_s_int);
  sched_note_printf(0, "      unsigned int["TONNAME(v_u_int)"]:[%u]", v_u_int);
  sched_note_printf(0, "     unsigned long["TONNAME(v_u_long)"]:[%lu]", (unsigned long)v_u_long);
  sched_note_printf(0, "unsigned long long["TONNAME(v_u_l_l)"]:[%llu]", (unsigned long long)v_u_l_l);
  sched_note_printf(0, "\n ###### end test!!! \n");

  sched_note_printf(0, "\n ###### start long args test!!! \n");
  sched_note_printf(0, "%u %u %u %d %d %d %f %f %lu %ld %d %u %d %u",
                    v_uint8_t, v_uint16_t, v_uint32_t, v_uint8_t, v_uint16_t,
                    v_uint32_t, v_float, v_double, v_uint64_t, v_uint64_t,
                    v_u_char, v_u_char, v_u_s_int, v_u_s_int);

  sched_note_printf(0, "%s %s %s %s %s %s %s %s %s %s %s %s %s %s",
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr),
                    TONNAME(v_char_arr), TONNAME(v_char_arr));
  sched_note_printf(0, "\n ###### start long args test!!! \n");
\#endif // !CONFIG_DRIVERS_NOTE_STRIP_FORMAT
  return 0;
}

drivers/note/noteram_driver.c

Signed-off-by: likun17 <[email protected]>
Copy link

This PR exceeds the recommended size of 1000 lines. Please make sure you are NOT addressing multiple issues with one PR. Note this PR might be rejected due to its size.

@xiaoxiang781216 xiaoxiang781216 merged commit 8b0e5ee into apache:master Oct 13, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: XL The size of the change in this PR is very large. Consider breaking down the PR into smaller pieces.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants