Skip to content

Commit

Permalink
Added specific event types.
Browse files Browse the repository at this point in the history
  • Loading branch information
dam7633 committed Mar 20, 2013
1 parent 4f43893 commit 7681eb9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Scheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ void* Scheduler::run() {
}

#if TRACE_EVENT_LOG_DEBUG
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERFIRST, "Scheduling");
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_SCHEDULING_START, "Scheduling");
#endif

scheduleTasks();

#if TRACE_EVENT_LOG_DEBUG
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERLAST, "Done Scheduling");
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_SCHEDULING_END, "Done Scheduling");
#endif

for (std::size_t i = 0; i < taskSet.size(); i++) {
Expand All @@ -67,11 +67,11 @@ void* Scheduler::run() {
while (!killThread) {
sem_wait(&scheduleSem);
#if TRACE_EVENT_LOG_DEBUG
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERFIRST, "Scheduling");
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_SCHEDULING_START, "Scheduling");
#endif
scheduleTasks();
#if TRACE_EVENT_LOG_DEBUG
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERLAST, "Done Scheduling");
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_SCHEDULING_END, "Done Scheduling");
#endif
}

Expand Down
8 changes: 7 additions & 1 deletion SchedulingAlgorithms.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,13 @@
/**
* TRACE_EVENT_CODE
*
*
* Enumeration of trace event types used by this fixture.
*/
#define TRACE_EVENT_SCHEDULING_START 10
#define TRACE_EVENT_SCHEDULING_END 11
#define TRACE_EVENT_TASK_START 20
#define TRACE_EVENT_TASK_END 21
#define TRACE_EVENT_DEADLINE_TIMER 30
#define TRACE_EVENT_DEADLINE_MISS 31

#endif /* SCHEDULINGALOGIRTHMS_H_ */
8 changes: 4 additions & 4 deletions Task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void* Task::run() {
while(!killThread) {
sem_wait(&doWork); // Block until the deadline passes so we don't do work
#if TRACE_EVENT_LOG_NORMAL
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERFIRST, runningMsg);
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_TASK_START, runningMsg);
#endif
while(completedTime < computeTime) {
nanospin_ns(BUSY_WAIT_NANO); //spin for a time tick
Expand All @@ -78,7 +78,7 @@ void* Task::run() {
}
completedTime = 0; // reset the completedTime for SCT finished state.
#if TRACE_EVENT_LOG_DEBUG
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERLAST, finishedMsg);
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_TASK_END, finishedMsg);
#endif
state = TP_FINISHED;
sem_post(scheduler); // signal the scheduler it is time to schedule again (because the task finished)
Expand Down Expand Up @@ -141,13 +141,13 @@ void Task::tick(union sigval sig) {
Task* self = (Task*) sig.sival_ptr;

#if TRACE_EVENT_LOG_DEBUG
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERFIRST, self->deadlineTimerMsg);
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_DEADLINE_TIMER, self->deadlineTimerMsg);
#endif

//if the task hasn't finished since the last deadline...
if(self->state != TP_FINISHED) {
#if TRACE_EVENT_LOG_CRITICAL
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, _NTO_TRACE_USERFIRST, self->deadlineMissedMsg);
TraceEvent(_NTO_TRACE_INSERTUSRSTREVENT, TRACE_EVENT_DEADLINE_MISS, self->deadlineMissedMsg);
#endif
}

Expand Down

0 comments on commit 7681eb9

Please sign in to comment.