00001 /* 00002 * RealTimeSchedule.hh 00003 * 00004 * Copyright (c) 2003, 2004 The University of Utah and the Flux Group. 00005 * All rights reserved. 00006 * 00007 * This file is licensed under the terms of the GNU Public License. 00008 * See the file "license.terms" for restrictions on redistribution 00009 * of this file, and for a DISCLAIMER OF ALL WARRANTIES. 00010 */ 00011 00012 /** 00013 * @file RealTimeSchedule.hh 00014 * 00015 * Header file for the RealTimeSchedule helper class. 00016 */ 00017 00018 #ifndef _cpu_schedule_hh 00019 #define _cpu_schedule_hh 00020 00021 #include "BrokerC.h" 00022 00023 #include <rt_scheduler.h> 00024 00025 /** 00026 * The RealTimeSchedule class is used to help policies that manage 00027 * Broker::RealTimeTask's. 00028 */ 00029 class RealTimeSchedule 00030 { 00031 00032 public: 00033 00034 /** 00035 * Construct a RealTimeSchedule object with the given values. 00036 * 00037 * @param start The start time for the task. 00038 * @param period The task period in microseconds. 00039 * @param deadline The task deadline in microseconds, relative to the start 00040 * of the period. 00041 * @param reserve_mode The reservation mode for the schedule. 00042 * @param pid A PID for a process to be scheduled. 00043 */ 00044 RealTimeSchedule(CORBA::ULong start = 0, 00045 CORBA::ULong period = 0, 00046 CORBA::ULong deadline = 0, 00047 rts_reserve_mode_t reserve_mode = RTS_RSV_SOFT, 00048 pid_t pid = -1); 00049 00050 /** 00051 * Set the members from a Broker::ScheduleParameters sequence. 00052 * 00053 * @param sp The sequence to take values from. 00054 */ 00055 void setParameters(const Broker::ScheduleParameters &sp) 00056 throw (Broker::DuplicateScheduleParameter, 00057 Broker::InvalidScheduleParameter, 00058 Broker::MissingScheduleParameter); 00059 00060 /** 00061 * Deconstruct a RealTimeSchedule object. 00062 */ 00063 virtual ~RealTimeSchedule(); 00064 00065 /** 00066 * Compute the number of microseconds that this schedule will have to 00067 * execute during the given time frame. 00068 * 00069 * @param start The start of the time frame, in microseconds. 00070 * @param stop The end of the time frame, in microseconds. 00071 * @return The number of microseconds during the time frame in which this 00072 * task will be schedulable. 00073 */ 00074 CORBA::ULong intersect(CORBA::ULong start, CORBA::ULong stop); 00075 00076 /** 00077 * The start time for the task. 00078 * 00079 * @todo Use a long long or timespec here. 00080 */ 00081 CORBA::ULong rts_Start; 00082 00083 /** The task period in microseconds. */ 00084 CORBA::ULong rts_Period; 00085 00086 /** 00087 * The task deadline in microseconds, relative to the start of the 00088 * period. 00089 */ 00090 CORBA::ULong rts_Deadline; 00091 00092 /** 00093 * The reservation mode for the schedule, either hard or soft. 00094 */ 00095 rts_reserve_mode_t rts_ReserveMode; 00096 00097 /** 00098 * The process ID this schedule refers to. 00099 */ 00100 pid_t rts_PID; 00101 00102 }; 00103 00104 #endif