Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
f4grx
NuttX RTOS
Commits
ccbf5142
Commit
ccbf5142
authored
9 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Add task state to information recorded when a task is suspended
parent
f7b58e9d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
arch
+1
-1
1 addition, 1 deletion
arch
fs/procfs/fs_procfsproc.c
+3
-3
3 additions, 3 deletions
fs/procfs/fs_procfsproc.c
include/nuttx/sched_note.h
+11
-3
11 additions, 3 deletions
include/nuttx/sched_note.h
sched/sched/sched_note.c
+37
-41
37 additions, 41 deletions
sched/sched/sched_note.c
with
52 additions
and
48 deletions
arch
@
e473d2df
Subproject commit
2a3c96286af41c261411d9cdd17e98e2ee18dc2e
Subproject commit
e473d2dfda7181296f10103bde2323d8df4c2ddb
This diff is collapsed.
Click to expand it.
fs/procfs/fs_procfsproc.c
+
3
−
3
View file @
ccbf5142
...
...
@@ -302,7 +302,7 @@ static const struct proc_node_s * const g_level0info[] =
/* This is the list of all group sub-directory nodes */
static
const
struct
proc_node_s
*
const
g_groupinfo
[]
=
static
FAR
const
struct
proc_node_s
*
const
g_groupinfo
[]
=
{
&
g_groupstatus
,
/* Task group status */
&
g_groupfd
/* Group file descriptors */
...
...
@@ -311,7 +311,7 @@ static const struct proc_node_s * const g_groupinfo[] =
/* Names of task/thread states */
static
const
char
*
g_statenames
[]
=
static
FAR
const
char
*
g_statenames
[]
=
{
"Invalid"
,
"Waiting,Unlock"
,
...
...
@@ -328,7 +328,7 @@ static const char *g_statenames[] =
#endif
};
static
const
char
*
g_ttypenames
[
4
]
=
static
FAR
const
char
*
g_ttypenames
[
4
]
=
{
"Task"
,
"pthread"
,
...
...
This diff is collapsed.
Click to expand it.
include/nuttx/sched_note.h
+
11
−
3
View file @
ccbf5142
...
...
@@ -107,11 +107,19 @@ struct note_stop_s
struct
note_common_s
nsp_cmn
;
/* Common note parameters */
};
/* This is the specific form of the NOTE_SUSPEND
/NOTE_RESUME
note */
/* This is the specific form of the NOTE_SUSPEND note */
struct
note_s
witch
_s
struct
note_s
uspend
_s
{
struct
note_common_s
nsw_cmn
;
/* Common note parameters */
struct
note_common_s
nsu_cmn
;
/* Common note parameters */
uint8_t
nsu_state
;
/* Task state */
};
/* This is the specific form of the NOTE_RESUME note */
struct
note_resume_s
{
struct
note_common_s
nre_cmn
;
/* Common note parameters */
};
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
...
...
This diff is collapsed.
Click to expand it.
sched/sched/sched_note.c
+
37
−
41
View file @
ccbf5142
...
...
@@ -263,45 +263,6 @@ static void note_add(FAR const uint8_t *note, uint8_t notelen)
g_note_info
.
ni_head
=
head
;
}
/****************************************************************************
* Name: sched_note_switch
*
* Description:
* Perform core logic for both sched_note_suspend and sched_note_resume
*
* Input Parameters:
* None
*
* Returned Value:
* None
*
* Assumptions:
* We are within a critical section.
*
****************************************************************************/
static
void
sched_note_switch
(
FAR
struct
tcb_s
*
tcb
,
uint8_t
type
)
{
struct
note_switch_s
note
;
/* Format the note */
note
.
nsw_cmn
.
nc_length
=
sizeof
(
struct
note_switch_s
);
note
.
nsw_cmn
.
nc_type
=
type
;
note
.
nsw_cmn
.
nc_priority
=
tcb
->
sched_priority
;
#ifdef CONFIG_SMP
note
.
nsw_cmn
.
nc_cpu
=
tcb
->
cpu
;
#endif
note
.
nsw_cmn
.
nc_pid
[
0
]
=
(
uint8_t
)(
tcb
->
pid
&
0xff
);
note
.
nsw_cmn
.
nc_pid
[
1
]
=
(
uint8_t
)((
tcb
->
pid
>>
8
)
&
0xff
);
note_systime
((
FAR
struct
note_common_s
*
)
&
note
);
/* Add the note to circular buffer */
note_add
((
FAR
const
uint8_t
*
)
&
note
,
sizeof
(
struct
note_switch_s
));
}
/****************************************************************************
* Public Functions
****************************************************************************/
...
...
@@ -388,12 +349,47 @@ void sched_note_stop(FAR struct tcb_s *tcb)
void
sched_note_suspend
(
FAR
struct
tcb_s
*
tcb
)
{
sched_note_switch
(
tcb
,
NOTE_SUSPEND
);
struct
note_suspend_s
note
;
/* Format the note */
note
.
nsu_cmn
.
nc_length
=
sizeof
(
struct
note_suspend_s
);
note
.
nsu_cmn
.
nc_type
=
NOTE_SUSPEND
;
note
.
nsu_cmn
.
nc_priority
=
tcb
->
sched_priority
;
#ifdef CONFIG_SMP
note
.
nsu_cmn
.
nc_cpu
=
tcb
->
cpu
;
#endif
note
.
nsu_cmn
.
nc_pid
[
0
]
=
(
uint8_t
)(
tcb
->
pid
&
0xff
);
note
.
nsu_cmn
.
nc_pid
[
1
]
=
(
uint8_t
)((
tcb
->
pid
>>
8
)
&
0xff
);
note
.
nsu_state
=
tcb
->
task_state
;
note_systime
((
FAR
struct
note_common_s
*
)
&
note
);
/* Add the note to circular buffer */
note_add
((
FAR
const
uint8_t
*
)
&
note
,
sizeof
(
struct
note_suspend_s
));
}
void
sched_note_resume
(
FAR
struct
tcb_s
*
tcb
)
{
sched_note_switch
(
tcb
,
NOTE_RESUME
);
struct
note_resume_s
note
;
/* Format the note */
note
.
nre_cmn
.
nc_length
=
sizeof
(
struct
note_resume_s
);
note
.
nre_cmn
.
nc_type
=
NOTE_RESUME
;
note
.
nre_cmn
.
nc_priority
=
tcb
->
sched_priority
;
#ifdef CONFIG_SMP
note
.
nre_cmn
.
nc_cpu
=
tcb
->
cpu
;
#endif
note
.
nre_cmn
.
nc_pid
[
0
]
=
(
uint8_t
)(
tcb
->
pid
&
0xff
);
note
.
nre_cmn
.
nc_pid
[
1
]
=
(
uint8_t
)((
tcb
->
pid
>>
8
)
&
0xff
);
note_systime
((
FAR
struct
note_common_s
*
)
&
note
);
/* Add the note to circular buffer */
note_add
((
FAR
const
uint8_t
*
)
&
note
,
sizeof
(
struct
note_resume_s
));
}
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment