schedulable.cpp

Go to the documentation of this file.
00001 #ifndef SCHEDULABLE_IMPLEMENTATION_FILE
00002 #define SCHEDULABLE_IMPLEMENTATION_FILE
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : schedulable                                                       *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *******************************************************************************
00010 * Copyright (c) 1991-$now By Author.  This program is free software; you can  *
00011 * redistribute it and/or modify it under the terms of the GNU General Public  *
00012 * License as published by the Free Software Foundation; either version 2 of   *
00013 * the License or (at your option) any later version.  This is online at:      *
00014 *     http://www.fsf.org/copyleft/gpl.html                                    *
00015 * Please send any updates to: fred@gruntose.com                               *
00016 \*****************************************************************************/
00017 
00018 #include "schedulable.h"
00019 
00020 #include <basis/istring.h>
00021 #include <mathematics/averager.cpp>
00022 
00023 schedulable::schedulable(const scheduling_id &item_id, int actor_id,
00024     const periodicity &when_to_schedule)
00025 : periodicity(when_to_schedule),
00026   _actor_id(actor_id),
00027   _sched_id(item_id),
00028   _stats(),
00029   _expiration_timer(1, when_to_schedule.expiration_interval),
00030   _preprocessed(false)
00031 {}
00032 
00033 schedulable::~schedulable() {}
00034 
00035 int schedulable::weight() const { return 1; }
00036 
00037 istring schedulable::schedulable_text_form() const
00038 {
00039   return istring(istring::SPRINTF, "schedulable[%d] with period [",
00040         _sched_id.raw_id())
00041       + periodicity::per_text_form()
00042       + istring(istring::SPRINTF, "], actor id of %d, heartbeat "
00043             "left %dms, stats: ", _actor_id, _expiration_timer.time_left())
00044       + _stats.text_form();
00045 }
00046 
00047 
00048 #endif //SCHEDULABLE_IMPLEMENTATION_FILE
00049 

Generated on Fri Nov 21 04:29:57 2008 for HOOPLE Libraries by  doxygen 1.5.1