From 2ea062642f7a9dc62b1682726d424533e8fd5698 Mon Sep 17 00:00:00 2001 From: yinshengkai Date: Mon, 26 Feb 2024 16:47:21 +0800 Subject: [PATCH] nshlib: Add startup process buried points Used for system startup time profiling Signed-off-by: yinshengkai --- nshlib/nsh_parse.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nshlib/nsh_parse.c b/nshlib/nsh_parse.c index c2ccb2a21de..01583aed6a3 100644 --- a/nshlib/nsh_parse.c +++ b/nshlib/nsh_parse.c @@ -39,6 +39,7 @@ #endif #include +#include #include "nshlib/nshlib.h" #include "nsh.h" @@ -2603,6 +2604,13 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline) size_t redirect_out2_len = strlen(g_redirect_out2); size_t redirect_in1_len = strlen(g_redirect_in1); +#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP + char tracebuf[CONFIG_NSH_LINELEN + 1]; + + strlcpy(tracebuf, cmdline, sizeof(tracebuf)); + sched_note_beginex(NOTE_TAG_APP, tracebuf); +#endif + /* Initialize parser state */ memset(argv, 0, MAX_ARGV_ENTRIES*sizeof(FAR char *)); @@ -2866,6 +2874,9 @@ static int nsh_parse_command(FAR struct nsh_vtbl_s *vtbl, FAR char *cmdline) dynlist_free: NSH_ALIASLIST_FREE(vtbl, &alist); NSH_MEMLIST_FREE(&memlist); +#ifdef CONFIG_SCHED_INSTRUMENTATION_DUMP + sched_note_endex(NOTE_TAG_APP, tracebuf); +#endif return ret; }