📄 dynsched.cpp
字号:
{
case RtecScheduler::ANOMALY_FATAL :
status_ = temp_status;
return status_;
case RtecScheduler::ANOMALY_ERROR :
severity = temp_severity;
status_ = temp_status;
break;
case RtecScheduler::ANOMALY_WARNING :
if (severity == RtecScheduler::ANOMALY_NONE)
{
severity = temp_severity;
status_ = temp_status;
}
break;
default:
break;
}
}
// propagate the dispatch information from the
// threads throughout the call graph
temp_status = propagate_dispatches (anomaly_set,
unresolved_locals,
unresolved_remotes);
if (temp_status != SUCCEEDED)
{
temp_severity = anomaly_severity (temp_status);
switch (temp_severity)
{
case RtecScheduler::ANOMALY_FATAL :
status_ = temp_status;
return status_;
case RtecScheduler::ANOMALY_ERROR :
severity = temp_severity;
status_ = temp_status;
break;
case RtecScheduler::ANOMALY_WARNING :
if (severity == RtecScheduler::ANOMALY_NONE)
{
severity = temp_severity;
status_ = temp_status;
}
break;
default:
break;
}
}
// log anomalies for unresolved local dependencies
if (unresolved_locals.length () > 0)
{
// Create an anomaly, add it to anomaly set
anomaly = create_anomaly (ST_UNRESOLVED_LOCAL_DEPENDENCIES);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
ACE_NEW_RETURN (anomaly, ACE_DynScheduler::Scheduling_Anomaly,
ST_VIRTUAL_MEMORY_EXHAUSTED);
ACE_CString temp_str ("The following entry points have "
"unresolved local dependencies:\n");
temp_str += unresolved_locals;
anomaly->severity =
anomaly_severity (ST_UNRESOLVED_LOCAL_DEPENDENCIES);
anomaly->description = temp_str.c_str ();
anomaly_set.insert (anomaly);
}
// log anomalies for unresolved remote dependencies
if (unresolved_remotes.length () > 0)
{
// Create an anomaly, add it to anomaly set
anomaly = create_anomaly (ST_UNRESOLVED_REMOTE_DEPENDENCIES);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
ACE_NEW_RETURN (anomaly, ACE_DynScheduler::Scheduling_Anomaly,
ST_VIRTUAL_MEMORY_EXHAUSTED);
ACE_CString temp_str ("The following entry points have "
"unresolved remote dependencies:\n");
temp_str += unresolved_remotes;
anomaly->severity =
anomaly_severity (ST_UNRESOLVED_REMOTE_DEPENDENCIES);
anomaly->description = temp_str.c_str ();
anomaly_set.insert (anomaly);
}
// invoke the internal dispatch scheduling method of the strategy
temp_status = schedule_dispatches (anomaly_set);
if (temp_status != SUCCEEDED)
{
temp_severity = anomaly_severity (temp_status);
switch (temp_severity)
{
case RtecScheduler::ANOMALY_FATAL :
status_ = temp_status;
return status_;
case RtecScheduler::ANOMALY_ERROR :
severity = temp_severity;
status_ = temp_status;
break;
case RtecScheduler::ANOMALY_WARNING :
if (severity == RtecScheduler::ANOMALY_NONE)
{
severity = temp_severity;
status_ = temp_status;
}
break;
default:
break;
}
}
// calculate utilization, total frame size, critical set
temp_status = calculate_utilization_params ();
if (temp_status != SUCCEEDED)
{
// Create an anomaly, add it to anomaly set
anomaly = create_anomaly (temp_status);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
switch (anomaly->severity)
{
case RtecScheduler::ANOMALY_FATAL :
status_ = temp_status;
return status_;
case RtecScheduler::ANOMALY_ERROR :
severity = anomaly->severity;
status_ = temp_status;
break;
case RtecScheduler::ANOMALY_WARNING :
if (severity == RtecScheduler::ANOMALY_NONE)
{
severity = anomaly->severity;
status_ = temp_status;
}
break;
default:
break;
}
}
// calculate utilization, total frame size, critical set
temp_status = store_assigned_info ();
if (temp_status != SUCCEEDED)
{
// Create an anomaly, add it to anomaly set
anomaly = create_anomaly (temp_status);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
switch (anomaly->severity)
{
case RtecScheduler::ANOMALY_FATAL :
status_ = temp_status;
return status_;
case RtecScheduler::ANOMALY_ERROR :
severity = anomaly->severity;
status_ = temp_status;
break;
case RtecScheduler::ANOMALY_WARNING :
if (severity == RtecScheduler::ANOMALY_NONE)
{
severity = anomaly->severity;
status_ = temp_status;
}
break;
default:
break;
}
}
// generate, store the timeline to a file if file was given
if (timeline_filename_ != 0)
{
// generate the scheduling timeline over the total frame size
temp_status = create_timeline ();
if (temp_status != SUCCEEDED)
{
// Create an anomaly, add it to anomaly set
anomaly = create_anomaly (temp_status);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
switch (anomaly->severity)
{
case RtecScheduler::ANOMALY_FATAL :
status_ = temp_status;
return status_;
case RtecScheduler::ANOMALY_ERROR :
severity = anomaly->severity;
status_ = temp_status;
break;
case RtecScheduler::ANOMALY_WARNING :
if (severity == RtecScheduler::ANOMALY_NONE)
{
severity = anomaly->severity;
status_ = temp_status;
}
break;
default:
break;
}
}
temp_status = output_timeline (timeline_filename_, 0);
if (temp_status != SUCCEEDED)
{
// Create an anomaly, add it to anomaly set
anomaly = create_anomaly (temp_status);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
switch (anomaly->severity)
{
case RtecScheduler::ANOMALY_FATAL :
status_ = temp_status;
return status_;
case RtecScheduler::ANOMALY_ERROR :
severity = anomaly->severity;
status_ = temp_status;
break;
case RtecScheduler::ANOMALY_WARNING :
if (severity == RtecScheduler::ANOMALY_NONE)
{
severity = anomaly->severity;
status_ = temp_status;
}
break;
default:
break;
}
}
}
// if a valid schedule was generated, mark it as up to date
switch (status_)
{
// These are statuses that indicate a reasonable schedule was generated.
case SUCCEEDED:
case ST_TASK_ALREADY_REGISTERED :
case ST_UNRESOLVED_REMOTE_DEPENDENCIES :
case ST_UTILIZATION_BOUND_EXCEEDED :
case ST_INSUFFICIENT_THREAD_PRIORITY_LEVELS :
// if we made it here, the schedule is done
up_to_date_ = 1;
break;
default:
break;
}
return status_;
}
ACE_DynScheduler::status_t
ACE_DynScheduler::propagate_dispatches (
ACE_Unbounded_Set<RtecScheduler::Scheduling_Anomaly *> &anomaly_set,
ACE_CString & unresolved_locals,
ACE_CString & unresolved_remotes)
{
u_long i;
frame_size_ = 1;
status_t status = SUCCEEDED;
Scheduling_Anomaly * anomaly = 0;
// iterate through the ordered_task_entries_ array in order
// from highest DFS finishing time to lowest, so that every
// calling dispatch is accessed before those it calls:
// the dispatches propagate top down through the call DAG
for (i = 0; i < tasks (); ++i)
{
switch (ordered_task_entries_ [i]->merge_dispatches (*dispatch_entries_,
unresolved_locals,
unresolved_remotes))
{
case Task_Entry::INTERNAL_ERROR :
// Create an anomaly, add it to anomaly set
anomaly = create_anomaly (ST_BAD_INTERNAL_POINTER);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
return ST_BAD_INTERNAL_POINTER;
case Task_Entry::TWO_WAY_DISJUNCTION :
if (status == SUCCEEDED)
{
status = TWO_WAY_DISJUNCTION;
}
anomaly = create_anomaly (TWO_WAY_DISJUNCTION);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
break;
case Task_Entry::TWO_WAY_CONJUNCTION :
if (status == SUCCEEDED)
{
status = TWO_WAY_CONJUNCTION;
}
anomaly = create_anomaly (TWO_WAY_CONJUNCTION);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
break;
case Task_Entry::UNRECOGNIZED_INFO_TYPE :
if (status == SUCCEEDED)
{
status = UNRECOGNIZED_INFO_TYPE;
}
anomaly = create_anomaly (UNRECOGNIZED_INFO_TYPE);
if (anomaly)
{
anomaly_set.insert (anomaly);
}
else
{
return ST_VIRTUAL_MEMORY_EXHAUSTED;
}
break;
case Task_Entry::SUCCEEDED :
default:
break;
}
if (ordered_task_entries_ [i]->effective_period () > 0)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -