This is the mail archive of the sid@sources.redhat.com mailing list for the SID project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch][rfa] "active" pin of sid-sched


Hi,

This patch modifies the sid-sched compont so that it only drives its 'active' pin when the threshold from being active to inactive is crossed. This is mainly an optimization.

ok to commit?

Dave
2003-08-29  Dave Brolley  <brolley@redhat.com>

	* compSched.cxx (operator <<): Stream active_pin.
	(operator >>): Ditto.
	(active_pin): New member of scheduler_component.
	(advance): Drive active_pin with 1 or 0 as the enable
	threshold is crossed.
	(scheduler_component): Add "active_pin".
	(sid-sched.xml): Document "active" pin and interaction between
	"enabled?" and "enable-threshold".
	(sid-sched.txt): Regenerated.

Index: sid/component/sched/compSched.cxx
===================================================================
RCS file: /cvs/src/src/sid/component/sched/compSched.cxx,v
retrieving revision 1.11
diff -c -p -r1.11 compSched.cxx
*** sid/component/sched/compSched.cxx	29 Aug 2003 20:22:01 -0000	1.11
--- sid/component/sched/compSched.cxx	21 Oct 2003 17:03:57 -0000
*************** operator << (ostream& o, const scheduler
*** 1215,1220 ****
--- 1215,1221 ----
    o << "scheduler-state "
      << it.enable_threshold << " "
      << it.enable_p << " "
+     << it.active_p << " "
      << it.yield_host_time_threshold << " "
      << it.yield_host_time_p << " "
      << it.sched.step_cycle_limit << " "   // this is a component attribute
*************** operator >> (istream& i, scheduler_compo
*** 1261,1266 ****
--- 1262,1268 ----
      {
        i >> it.enable_threshold
          >> it.enable_p
+         >> it.active_p
  	>> it.yield_host_time_threshold
  	>> it.yield_host_time_p
  	>> it.sched.step_cycle_limit
*************** class scheduler_component: public schedu
*** 1335,1340 ****
--- 1337,1343 ----
    int enable_p;
    int yield_host_time_threshold;
    int yield_host_time_p;
+   bool active_p;
    host_int_8 advance_count;
    callback_pin<this_t> advance_pin;
    callback_pin<this_t> time_query_pin;
*************** protected:
*** 1396,1403 ****
  	       << this->yield_host_time_threshold << endl;
  #endif
  	  // Drive the active pin if the threshold has been crossed.
! 	  if (this->active_pin.recall() != 1)
! 	    this->active_pin.drive(1);
  
            this->advance_count ++;
    	  this->sched.advance (this->yield_host_time_p >= this->yield_host_time_threshold);
--- 1399,1409 ----
  	       << this->yield_host_time_threshold << endl;
  #endif
  	  // Drive the active pin if the threshold has been crossed.
! 	  if (UNLIKELY(! this->active_p))
! 	    {
! 	      this->active_pin.drive (1);
! 	      this->active_p = true;
! 	    }
  
            this->advance_count ++;
    	  this->sched.advance (this->yield_host_time_p >= this->yield_host_time_threshold);
*************** protected:
*** 1405,1412 ****
        else
  	{
  	  // Drive the active pin if the threshold has been crossed.
! 	  if (this->active_pin.recall() != 0)
! 	    this->active_pin.drive(0);
  	}
      }
  
--- 1411,1421 ----
        else
  	{
  	  // Drive the active pin if the threshold has been crossed.
! 	  if (UNLIKELY(this->active_p))
! 	    {
! 	      this->active_pin.drive (0);
! 	      this->active_p = false;
! 	    }
  	}
      }
  
*************** public:
*** 1444,1450 ****
      clients(0),
      num_clients(0),
      enable_threshold(1),
!     enable_p(1),
      yield_host_time_threshold(1), 
      yield_host_time_p(0), 
      advance_count(0),
--- 1453,1459 ----
      clients(0),
      num_clients(0),
      enable_threshold(1),
!     active_p(1),
      yield_host_time_threshold(1), 
      yield_host_time_p(0), 
      advance_count(0),
*************** public:
*** 1452,1457 ****
--- 1461,1467 ----
      time_query_pin(this, & scheduler_component::time_query),
      yield_pin(this, & scheduler_component::yield_step_loop)
      {
+       enable_p = enable_threshold;
        scheduler_component_ctor_1();
        scheduler_component_ctor_2();
        scheduler_component_ctor_3();
Index: sid/component/sched/sid-sched.xml
===================================================================
RCS file: /cvs/src/src/sid/component/sched/sid-sched.xml,v
retrieving revision 1.5
diff -c -p -r1.5 sid-sched.xml
*** sid/component/sched/sid-sched.xml	29 Aug 2003 19:45:10 -0000	1.5
--- sid/component/sched/sid-sched.xml	21 Oct 2003 17:03:57 -0000
***************
*** 137,144 ****
  
      <behavior name="advancing">
        <p> When you have disabled the scheduler by setting the
!       <attribute>enabled?</attribute> attribute to a value less than enable-threshold,
!       advancing as described below, does not occur.
        </p>
  
        <p> Whenever the <pin>advance</pin> input pin is driven, the scheduler
--- 137,144 ----
  
      <behavior name="advancing">
        <p> When you have disabled the scheduler by setting the
!       <attribute>enabled?</attribute> attribute to a value less than the <attribute>enable-threshold</attribute>
!       attribute, advancing as described below, does not occur.
        </p>
  
        <p> Whenever the <pin>advance</pin> input pin is driven, the scheduler

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]