- Put Simulation in stopped state before changing policy (doesn't

prevent a sigsegv if you try to change it while the simulation
is running)
- Use a red color to indicate a blocked thread / unallocable request
in widgets
- TODO: try the deadlock test w/ the rr (NOT the rr_priority) cpu
policy. There's something wrong with the policy...


git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1019 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
tchernobog 2006-09-06 08:46:06 +00:00
parent a4d6bf2771
commit d9d88e7032
3 changed files with 12 additions and 9 deletions

View File

@ -209,10 +209,12 @@ ConcreteSimulation::get_history() const
void
ConcreteSimulation::set_policy(CPUPolicy* p) throw(CPUPolicyException)
{
stop();
// NOTE: restoring of the previous policy is done here because I
// couldn't think of a clean way to do it
// inside activate_policy()
try
{
CPUPoliciesGatekeeper::get_instance().activate_policy(&_history, p);
@ -253,6 +255,7 @@ ConcreteSimulation::get_policy()
void
ConcreteSimulation::set_resource_policy(ResourcePolicy* p)
{
stop();
ResourcePoliciesGatekeeper::get_instance().activate_policy(&_history, p);
_resource_policy = p;
}

View File

@ -208,9 +208,9 @@ void HoltSchedulable::draw(cairo_t *cr)
break;
case Schedulable::state_blocked:
// cairo_set_source_rgb (cr, 1, 0, 0);
// blue
cairo_pattern_add_color_stop_rgba(gradient, 0.00, 0.5, 0.5, 1.0, 0.7);
cairo_pattern_add_color_stop_rgba(gradient, 1.00, 0.0, 0.0, 1.0, 1.0);
// red
cairo_pattern_add_color_stop_rgba(gradient, 0.00, 1.0, 0.5, 0.5, 0.7);
cairo_pattern_add_color_stop_rgba(gradient, 1.00, 1.0, 0.0, 0.0, 1.0);
cairo_set_source(cr, gradient);
break;
case Schedulable::state_future:
@ -276,8 +276,8 @@ void HoltRequest::draw(cairo_t *cr)
switch(_state)
{
case Request::state_unallocable:
// blue
cairo_set_source_rgb(cr, 0, 0, 1);
// red
cairo_set_source_rgb(cr, 1, 0, 0);
arrow(cr, schedulable, resource);
break;
case Request::state_allocated:

View File

@ -703,8 +703,8 @@ SimulationWidget::make_gradients()
cairo_pattern_add_color_stop_rgba(_running_process_gradient, 1.00, 0.0, 1.0, 0.0, 1.0);
_blocked_process_gradient = cairo_pattern_create_linear(0, 0, 0, _yu_process_bar_height * _y_unit);
// blue
cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 0.00, 0.5, 0.5, 1.0, 0.7);
cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 1.00, 0.0, 0.0, 1.0, 1.0);
// red
cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 0.00, 1.0, 0.5, 0.5, 0.7);
cairo_pattern_add_color_stop_rgba(_blocked_process_gradient, 1.00, 1.0, 0.0, 0.0, 1.0);
}