mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
sched_note: Extend OS instrumentation to include some SMP events.
This commit is contained in:
@@ -661,6 +661,14 @@ config SCHED_INSTRUMENTATION
|
||||
void sched_note_suspend(FAR struct tcb_s *tcb);
|
||||
void sched_note_resume(FAR struct tcb_s *tcb);
|
||||
|
||||
If CONFIG_SMP is enabled, then these additional interfaces are
|
||||
expected:
|
||||
|
||||
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu);
|
||||
void sched_note_cpu_paused(FAR struct tcb_s *tcb);
|
||||
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu);
|
||||
void sched_note_cpu_resumed(FAR struct tcb_s *tcb);
|
||||
|
||||
NOTE: These are internal OS interfaces and are called at at very
|
||||
critical locations in the OS. There is very little that can be
|
||||
done in these interfaces. For example, normal devices may not be
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include <nuttx/arch.h>
|
||||
#include <nuttx/sched_note.h>
|
||||
|
||||
#include "sched/sched.h"
|
||||
|
||||
|
||||
@@ -369,6 +369,62 @@ void sched_note_resume(FAR struct tcb_s *tcb)
|
||||
note_add((FAR const uint8_t *)¬e, sizeof(struct note_resume_s));
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
void sched_note_cpu_pause(FAR struct tcb_s *tcb, int cpu)
|
||||
{
|
||||
struct note_cpu_pause_s note;
|
||||
|
||||
/* Format the note */
|
||||
|
||||
note_common(tcb, ¬e.ncp_cmn, sizeof(struct note_cpu_pause_s), NOTE_CPU_PAUSE);
|
||||
note.ncp_target = (uint8_t)cpu;
|
||||
|
||||
/* Add the note to circular buffer */
|
||||
|
||||
note_add((FAR const uint8_t *)¬e, sizeof(struct note_cpu_pause_s));
|
||||
}
|
||||
|
||||
void sched_note_cpu_paused(FAR struct tcb_s *tcb)
|
||||
{
|
||||
struct note_cpu_paused_s note;
|
||||
|
||||
/* Format the note */
|
||||
|
||||
note_common(tcb, ¬e.ncp_cmn, sizeof(struct note_cpu_paused_s), NOTE_CPU_PAUSED);
|
||||
|
||||
/* Add the note to circular buffer */
|
||||
|
||||
note_add((FAR const uint8_t *)¬e, sizeof(struct note_cpu_paused_s));
|
||||
}
|
||||
|
||||
void sched_note_cpu_resume(FAR struct tcb_s *tcb, int cpu)
|
||||
{
|
||||
struct note_cpu_resume_s note;
|
||||
|
||||
/* Format the note */
|
||||
|
||||
note_common(tcb, ¬e.ncr_cmn, sizeof(struct note_cpu_resume_s), NOTE_CPU_RESUME);
|
||||
note.ncr_target = (uint8_t)cpu;
|
||||
|
||||
/* Add the note to circular buffer */
|
||||
|
||||
note_add((FAR const uint8_t *)¬e, sizeof(struct note_cpu_resume_s));
|
||||
}
|
||||
|
||||
void sched_note_cpu_resumed(FAR struct tcb_s *tcb)
|
||||
{
|
||||
struct note_cpu_resumed_s note;
|
||||
|
||||
/* Format the note */
|
||||
|
||||
note_common(tcb, ¬e.ncr_cmn, sizeof(struct note_cpu_resumed_s), NOTE_CPU_RESUMED);
|
||||
|
||||
/* Add the note to circular buffer */
|
||||
|
||||
note_add((FAR const uint8_t *)¬e, sizeof(struct note_cpu_resumed_s));
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
|
||||
void sched_note_premption(FAR struct tcb_s *tcb, bool locked)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user