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] Add "active" pin to sid-sched


Hi,

This patch adds an output pin, "active" to the sid-sched component which indicates when the scheduler is running. That is, when "enable?" is greater than or equal to "enable-threshold". This pin is driven with 0 when the scheduler is inactive and with 1 when it is active. This pin can be used by components which may need to change state depending on the state of the scheduler.

OK to commit?

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

	* compSched.cxx (operator <<): Stream active_p and active_pin.
	(operator >>): Ditto.
	(active_p): New member of scheduler_component.
	(active_pin): Ditto.
	(advance): Drive active_pin with 1 or 0 as the enable
	threshold is crossed.
	(scheduler_component): Initialize active_p. 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.9
diff -c -p -r1.9 compSched.cxx
*** sid/component/sched/compSched.cxx	6 Feb 2003 20:29:20 -0000	1.9
--- sid/component/sched/compSched.cxx	29 Aug 2003 16:02:54 -0000
*************** operator << (ostream& o, const scheduler
*** 1215,1224 ****
--- 1215,1226 ----
    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
      << it.advance_count << " "
+     << it.active_pin << " "
      << it.yield_pin << " "
      << it.advance_pin << endl;
  
*************** operator >> (istream& i, scheduler_compo
*** 1260,1269 ****
--- 1262,1273 ----
      {
        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
  	>> it.advance_count
+ 	>> it.active_pin
  	>> it.yield_pin
  	>> it.advance_pin;
  
*************** class scheduler_component: public schedu
*** 1333,1344 ****
--- 1337,1350 ----
    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;
    callback_pin<this_t> yield_pin;
    output_pin time_low_pin;
    output_pin time_high_pin;
+   output_pin active_pin;
  
  public:
  
*************** protected:
*** 1392,1400 ****
--- 1398,1422 ----
  	       << " yield_host_time_threshold=="
  	       << 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);
          }
+       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:
*** 1431,1436 ****
--- 1453,1459 ----
      clients(0),
      num_clients(0),
      enable_threshold(1),
+     active_p (false),
      enable_p(1),
      yield_host_time_threshold(1), 
      yield_host_time_p(0), 
*************** scheduler_component<Scheduler>::schedule
*** 1457,1462 ****
--- 1480,1486 ----
    add_pin ("time-high", & this->time_high_pin);
    add_pin ("time-low", & this->time_low_pin);
    add_pin ("yield", & this->yield_pin);
+   add_pin ("active", & this->active_pin);
    add_attribute ("yield", & this->yield_pin, "pin");
    add_attribute ("enable-threshold", & this->enable_threshold, "setting");
    add_attribute ("enabled?", & this->enable_p, "setting");
Index: sid/component/sched/sid-sched.txt
===================================================================
RCS file: /cvs/src/src/sid/component/sched/sid-sched.txt,v
retrieving revision 1.5
diff -c -p -r1.5 sid-sched.txt
*** sid/component/sched/sid-sched.txt	8 Jan 2003 03:42:16 -0000	1.5
--- sid/component/sched/sid-sched.txt	29 Aug 2003 16:02:56 -0000
*************** Functionality:
*** 148,154 ****
     |               | driving the N-event output pins |
     |               | with some value. A counter      |
     |               | accessed by the advance-count   |
!    |               | attribute is incremented.       |
     |               |                                 |
     |               | Whether any particular N-event  |
     |               | pin is driven depends on the    |
--- 148,167 ----
     |               | driving the N-event output pins |
     |               | with some value. A counter      |
     |               | accessed by the advance-count   |
!    |               | attribute is incremented. If    |
!    |               | the attribute enabled? has been |
!    |               | changed from a value below      |
!    |               | enable-threshold to a value     |
!    |               | greater than or equal to        |
!    |               | enable-threshold, then the pin  |
!    |               | active will be driven with the  |
!    |               | value 1. If the attribute       |
!    |               | enabled? has been changed from  |
!    |               | a value grater than or equal to |
!    |               | enable-threshold to a value     |
!    |               | less than enable-threshold,     |
!    |               | then the pin active will be     |
!    |               | driven with the value 0.        |
     |               |                                 |
     |               | Whether any particular N-event  |
     |               | pin is driven depends on the    |
*************** Component Reference:
*** 245,250 ****
--- 258,265 ----
     |----------+---------+---------------+------------|
     |yield     |in       |any            |advancing   |
     |----------+---------+---------------+------------|
+    |active    |out      |boolean        |advancing   |
+    |----------+---------+---------------+------------|
     |N-event   |out      |no value       |advancing   |
     |----------+---------+---------------+------------|
     |N-control |in       |coded value    |subscription|
*************** Component Reference:
*** 288,296 ****
     |-------------------------+--------+--------+----------------+-------------||
     |yield                    |pin     |-       |-               |advancing    ||
     |-------------------------+--------+--------+----------------+-------------||
!    |enable-theshold          |setting |numeric |'1'             |advancing    ||
     |-------------------------+--------+--------+----------------+-------------||
!    |enabled?                 |setting |numeric |enable-threshold|advancing    ||
     |-------------------------+--------+--------+----------------+-------------||
     |yield-host-time-threshold|setting |numeric |'1'             |timing       ||
     |-------------------------+--------+--------+----------------+-------------||
--- 303,311 ----
     |-------------------------+--------+--------+----------------+-------------||
     |yield                    |pin     |-       |-               |advancing    ||
     |-------------------------+--------+--------+----------------+-------------||
!    |enabled?                 |setting |numeric |'1'             |advancing    ||
     |-------------------------+--------+--------+----------------+-------------||
!    |enable-threshold         |setting |numeric |'1'             |advancing    ||
     |-------------------------+--------+--------+----------------+-------------||
     |yield-host-time-threshold|setting |numeric |'1'             |timing       ||
     |-------------------------+--------+--------+----------------+-------------||
Index: sid/component/sched/sid-sched.xml
===================================================================
RCS file: /cvs/src/src/sid/component/sched/sid-sched.xml,v
retrieving revision 1.4
diff -c -p -r1.4 sid-sched.xml
*** sid/component/sched/sid-sched.xml	8 Jan 2003 03:42:16 -0000	1.4
--- sid/component/sched/sid-sched.xml	29 Aug 2003 16:02:56 -0000
***************
*** 8,13 ****
--- 8,14 ----
      <!-- pins -->
      <defpin name="advance" direction="in" legalvalues="any" behaviors="advancing" />
      <defpin name="yield" direction="in" legalvalues="any" behaviors="advancing" />
+     <defpin name="active" direction="out" legalvalues="boolean" behaviors="advancing" />
      <defpin name="N-event" direction="out" legalvalues="no value" behaviors="advancing" />
      <defpin name="N-control" direction="in" legalvalues="coded value" behaviors="subscription" />
      <defpin name="time-query" direction="in" legalvalues="any" behaviors="timing" />
***************
*** 26,33 ****
      <defattribute name="N-control" category="pin" behaviors="subscription" />
      <defattribute name="advance" category="pin" behaviors="advancing" />
      <defattribute name="yield" category="pin" behaviors="advancing" />
!     <defattribute name="enable-theshold" category="setting" legalvalues="numeric" defaultvalue="'1'" behaviors="advancing" />
!     <defattribute name="enabled?" category="setting" legalvalues="numeric" defaultvalue="enable-threshold" behaviors="advancing" />
      <defattribute name="yield-host-time-threshold" category="setting" legalvalues="numeric" defaultvalue="'1'" behaviors="timing" />
      <defattribute name="yield-host-time?" category="setting" legalvalues="numeric" defaultvalue="'0'" behaviors="timing" />
      <defattribute name="step-cycle-limit" category="setting" legalvalues="numeric" defaultvalue="advancing" />
--- 27,34 ----
      <defattribute name="N-control" category="pin" behaviors="subscription" />
      <defattribute name="advance" category="pin" behaviors="advancing" />
      <defattribute name="yield" category="pin" behaviors="advancing" />
!     <defattribute name="enable-threshold" category="setting" legalvalues="numeric" defaultvalue="'1'" behaviors="advancing" />
!     <defattribute name="enabled?" category="setting" legalvalues="numeric" defaultvalue="'1'" behaviors="advancing" />
      <defattribute name="yield-host-time-threshold" category="setting" legalvalues="numeric" defaultvalue="'1'" behaviors="timing" />
      <defattribute name="yield-host-time?" category="setting" legalvalues="numeric" defaultvalue="'0'" behaviors="timing" />
      <defattribute name="step-cycle-limit" category="setting" legalvalues="numeric" defaultvalue="advancing" />
***************
*** 136,149 ****
  
      <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
        may dispatch one or more signals by driving the <pin>N-event</pin> output
        pins with some value.  A counter accessed by the <attribute>advance-count</attribute>
!       attribute is incremented.
        </p>
  
        <p> Whether any particular <pin>N-event</pin> pin is driven depends on
--- 137,157 ----
  
      <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
        may dispatch one or more signals by driving the <pin>N-event</pin> output
        pins with some value.  A counter accessed by the <attribute>advance-count</attribute>
!       attribute is incremented. If the attribute <attribute>enabled?</attribute> has
!       been changed from a value below <attribute>enable-threshold</attribute> to a value
!       greater than or equal to <attribute>enable-threshold</attribute>, then the pin
!       <pin>active</pin> will be driven with the value 1. If the attribute
!       <attribute>enabled?</attribute> has been changed from a value grater than or equal to
!       <attribute>enable-threshold</attribute> to a value less than 
!       <attribute>enable-threshold</attribute>, then the pin
!       <pin>active</pin> will be driven with the value 0.
        </p>
  
        <p> Whether any particular <pin>N-event</pin> pin is driven depends on

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