sched_note: Extend OS instrumentation to include some SMP events.

This commit is contained in:
Gregory Nutt
2016-11-27 17:14:57 -06:00
parent cbf98ae0a0
commit d65be718c2
8 changed files with 176 additions and 3 deletions
+8
View File
@@ -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
+1
View File
@@ -44,6 +44,7 @@
#include <errno.h>
#include <nuttx/arch.h>
#include <nuttx/sched_note.h>
#include "sched/sched.h"
+56
View File
@@ -369,6 +369,62 @@ void sched_note_resume(FAR struct tcb_s *tcb)
note_add((FAR const uint8_t *)&note, 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, &note.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 *)&note, 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, &note.ncp_cmn, sizeof(struct note_cpu_paused_s), NOTE_CPU_PAUSED);
/* Add the note to circular buffer */
note_add((FAR const uint8_t *)&note, 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, &note.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 *)&note, 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, &note.ncr_cmn, sizeof(struct note_cpu_resumed_s), NOTE_CPU_RESUMED);
/* Add the note to circular buffer */
note_add((FAR const uint8_t *)&note, sizeof(struct note_cpu_resumed_s));
}
#endif
#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
void sched_note_premption(FAR struct tcb_s *tcb, bool locked)
{