Add task state to information recorded when a task is suspended
This commit is contained in:
parent
f7b58e9dfd
commit
ccbf514233
2
arch
2
arch
@ -1 +1 @@
|
|||||||
Subproject commit 2a3c96286af41c261411d9cdd17e98e2ee18dc2e
|
Subproject commit e473d2dfda7181296f10103bde2323d8df4c2ddb
|
@ -302,7 +302,7 @@ static const struct proc_node_s * const g_level0info[] =
|
|||||||
|
|
||||||
/* This is the list of all group sub-directory nodes */
|
/* 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_groupstatus, /* Task group status */
|
||||||
&g_groupfd /* Group file descriptors */
|
&g_groupfd /* Group file descriptors */
|
||||||
@ -311,7 +311,7 @@ static const struct proc_node_s * const g_groupinfo[] =
|
|||||||
|
|
||||||
/* Names of task/thread states */
|
/* Names of task/thread states */
|
||||||
|
|
||||||
static const char *g_statenames[] =
|
static FAR const char *g_statenames[] =
|
||||||
{
|
{
|
||||||
"Invalid",
|
"Invalid",
|
||||||
"Waiting,Unlock",
|
"Waiting,Unlock",
|
||||||
@ -328,7 +328,7 @@ static const char *g_statenames[] =
|
|||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *g_ttypenames[4] =
|
static FAR const char *g_ttypenames[4] =
|
||||||
{
|
{
|
||||||
"Task",
|
"Task",
|
||||||
"pthread",
|
"pthread",
|
||||||
|
@ -107,11 +107,19 @@ struct note_stop_s
|
|||||||
struct note_common_s nsp_cmn; /* Common note parameters */
|
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_switch_s
|
struct note_suspend_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
|
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
|
||||||
|
@ -263,45 +263,6 @@ static void note_add(FAR const uint8_t *note, uint8_t notelen)
|
|||||||
g_note_info.ni_head = head;
|
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 *)¬e);
|
|
||||||
|
|
||||||
/* Add the note to circular buffer */
|
|
||||||
|
|
||||||
note_add((FAR const uint8_t *)¬e, sizeof(struct note_switch_s));
|
|
||||||
}
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Public Functions
|
* Public Functions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@ -388,12 +349,47 @@ void sched_note_stop(FAR struct tcb_s *tcb)
|
|||||||
|
|
||||||
void sched_note_suspend(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 *)¬e);
|
||||||
|
|
||||||
|
/* Add the note to circular buffer */
|
||||||
|
|
||||||
|
note_add((FAR const uint8_t *)¬e, sizeof(struct note_suspend_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
void sched_note_resume(FAR struct tcb_s *tcb)
|
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 *)¬e);
|
||||||
|
|
||||||
|
/* Add the note to circular buffer */
|
||||||
|
|
||||||
|
note_add((FAR const uint8_t *)¬e, sizeof(struct note_resume_s));
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
|
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
|
||||||
|
Loading…
Reference in New Issue
Block a user