diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-12-11 02:45:11 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-12-11 02:45:11 +0000 |
commit | 3b9469d11341ec4b81a9b8707635b6ed76340877 (patch) | |
tree | 62fdb1a532d98ad8d2da70958983a0ae1ef06ad3 /TAO/orbsvcs/orbsvcs/Scheduler_Factory.h | |
parent | cea26aeb6e1bc30c754707f0936d199e08bea071 (diff) | |
download | ATCD-3b9469d11341ec4b81a9b8707635b6ed76340877.tar.gz |
ChangeLogTag:Wed Dec 10 20:13:57 1997 Carlos O'Ryan <coryan@macarena.cs.wustl.edu>
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Scheduler_Factory.h')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Scheduler_Factory.h | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h new file mode 100644 index 00000000000..fa2411cd9e9 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Scheduler_Factory.h @@ -0,0 +1,98 @@ +// ============================================================================ +// +// $Id$ +// +// ============================================================================ + +#ifndef ACE_SCHEDULER_FACTORY_H +#define ACE_SCHEDULER_FACTORY_H + +#include "ace/OS.h" + +#include "orbsvcs/CosNamingC.h" +#include "orbsvcs/RtecSchedulerC.h" + +class ACE_Scheduler_Factory + // = TITLE + // Factory of scheduler services. + // + // = DESCRIPTION + // This class acts as a factory for scheduler servers. At config + // time it will return a remote server, which will actually + // compute the scheduling parameters. At run-time it returns a + // local server, which will use the results of the config runs to + // actually do the scheduling, without incurring in RPC overheads. +{ +public: + struct POD_RT_Info + // = TITLE + // Plain Old Data for RT_Infos. + // + // = DESCRIPTION + // This class provide us with a plain old data version of + // RT_Info, this is useful for implementing static arrays or of + // those. + { + const char* entry_point; + RtecScheduler::handle_t handle; + RtecScheduler::Time worst_case_execution_time; + RtecScheduler::Time typical_execution_time; + RtecScheduler::Time cached_execution_time; + RtecScheduler::Period period; + RtecScheduler::Importance importance; + RtecScheduler::Quantum quantum; + CORBA::Long threads; + RtecScheduler::OS_Priority priority; + RtecScheduler::Sub_Priority subpriority; + RtecScheduler::Preemption_Priority preemption_priority; + }; + + static int use_config (CosNaming::NamingContext_ptr naming); + // Setup the variables needed for a config run, using the + // NamingContext to locate a Scheduler. + + static int use_config (CORBA::ORB_ptr orb); + // Setup the variable needed for a config run, using an environment + // variable to locate a Scheduler. + + static int use_runtime (int entry_count, + POD_RT_Info rt_info[]); + // Disable config runs in the Factory and setups the precomputed + // scheduling. + + static RtecScheduler::Scheduler_ptr server (void); + // Return the Real-time Scheduling Service used for this run. + // Must have been configured either using use_context() or use_data(). + // + // Normally use_data() is called at static elaboration time, so + // everything is automatic. + // On config runs use_context() is called from main, after + // resolve_initial_references. + + static int dump_schedule (const RtecScheduler::RT_Info_Set& infos, + const char* file_name = 0); + // This helper function will dump the schedule returned by a + // RtecScheduler::Scheduler into a file, the file can be compiled to + // create an efficient local implementation of the Scheduler. + + // TODO: How to do cleanup()? Use the ACE_Object_Manager stuff? + +protected: + static int no_config_run (void); + // By default this factory assumes we are runnning a config + // run. Calling this method disables that. + // Since the methods returns an int it can be used to initialize a + // static variable, hence calling it before main(); this technique + // can be used in the code emitted for the run-time scheduler, + // automagically disabling the config_run() when that code is linked + // in. + +private: + static RtecScheduler::Scheduler_ptr server_; +}; + +#if defined (__ACE_INLINE__) +#include "orbsvcs/Scheduler_Factory.i" +#endif /* __ACE_INLINE__ */ + +#endif /* ACE_SCHEDULER_FACTORY_H */ |