MCPcopy Create free account
hub / github.com/apache/nuttx / sched_note_preemption

Function sched_note_preemption

drivers/note/note_driver.c:1055–1096  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1053
1054#ifdef CONFIG_SCHED_INSTRUMENTATION_PREEMPTION
1055void sched_note_preemption(FAR struct tcb_s *tcb, bool locked)
1056{
1057 struct note_preempt_s note;
1058 FAR struct note_driver_s **driver;
1059 bool formatted = false;
1060 irqstate_t flags;
1061
1062 flags = spin_lock_irqsave_notrace(&g_note_lock);
1063 for (driver = g_note_drivers; *driver; driver++)
1064 {
1065 if (!note_isenabled(*driver))
1066 {
1067 continue;
1068 }
1069
1070 if (note_preemption(*driver, tcb, locked))
1071 {
1072 continue;
1073 }
1074
1075 if ((*driver)->ops->add == NULL)
1076 {
1077 continue;
1078 }
1079
1080 /* Format the note */
1081
1082 if (!formatted)
1083 {
1084 formatted = true;
1085 note_common(tcb, &note.npr_cmn, sizeof(struct note_preempt_s),
1086 locked ? NOTE_PREEMPT_LOCK : NOTE_PREEMPT_UNLOCK);
1087 note.npr_count = tcb->lockcount;
1088 }
1089
1090 /* Add the note to circular buffer */
1091
1092 note_add(*driver, &note, sizeof(struct note_preempt_s));
1093 }
1094
1095 spin_unlock_irqrestore_notrace(&g_note_lock, flags);
1096}
1097#endif
1098
1099#ifdef CONFIG_SCHED_INSTRUMENTATION_CSECTION

Callers 2

sched_lockFunction · 0.85
sched_unlockFunction · 0.85

Calls 3

note_isenabledFunction · 0.85
note_commonFunction · 0.85

Tested by

no test coverage detected