From: tho Date: Tue, 8 Mar 2011 14:43:47 +0000 (+0000) Subject: added scheduler watchdog members to sys/scheduler console dir X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=57daeae6f2e924ce3f16f9677c3474f531cba9e5;p=senf.git added scheduler watchdog members to sys/scheduler console dir fixed some typos git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1771 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/Scheduler/ConsoleDir.cc b/senf/Scheduler/ConsoleDir.cc new file mode 100644 index 0000000..ac0d2a9 --- /dev/null +++ b/senf/Scheduler/ConsoleDir.cc @@ -0,0 +1,64 @@ +// $Id$ +// +// Copyright (C) 2011 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Thorsten Horstmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/** \file + \brief Scheduler ConsoleDir non-inline non-template implementation */ + +#include "ConsoleDir.hh" +#include "ConsoleDir.ih" + +// Custom includes +#include +#include + +#define prefix_ +//-///////////////////////////////////////////////////////////////////////////////////////////////// + +prefix_ senf::console::ScopedDirectory<> & senf::scheduler::consoleDir() +{ + return detail::ConsoleDirManager::instance().consoleDir(); +} + +prefix_ senf::console::ScopedDirectory<> & +senf::scheduler::detail::ConsoleDirManager::consoleDir() +{ + return consoleDir_(); +} + +prefix_ senf::scheduler::detail::ConsoleDirManager::ConsoleDirManager() +{ + console::sysdir().add("scheduler", consoleDir_()); +} + +//-///////////////////////////////////////////////////////////////////////////////////////////////// +#undef prefix_ + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/senf/Scheduler/ConsoleDir.hh b/senf/Scheduler/ConsoleDir.hh new file mode 100644 index 0000000..135b537 --- /dev/null +++ b/senf/Scheduler/ConsoleDir.hh @@ -0,0 +1,57 @@ +// $Id$ +// +// Copyright (C) 2011 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Thorsten Horstmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/** \file + \brief Scheduler ConsoleDir public header */ + +#ifndef HH_SENF_Scheduler_ConsoleDir_ +#define HH_SENF_Scheduler_ConsoleDir_ 1 + +// Custom includes +#include + +//#include "Sysdir.mpp" +//-///////////////////////////////////////////////////////////////////////////////////////////////// + +namespace senf { +namespace scheduler { + + console::ScopedDirectory<> & consoleDir(); + +}} + +//-///////////////////////////////////////////////////////////////////////////////////////////////// +//#include "ConsoleDir.cci" +//#include "ConsoleDir.ct" +//#include "ConsoleDir.cti" +#endif + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/senf/Scheduler/ConsoleDir.ih b/senf/Scheduler/ConsoleDir.ih new file mode 100644 index 0000000..394322d --- /dev/null +++ b/senf/Scheduler/ConsoleDir.ih @@ -0,0 +1,69 @@ +// $Id$ +// +// Copyright (C) 2011 +// Fraunhofer Institute for Open Communication Systems (FOKUS) +// Competence Center NETwork research (NET), St. Augustin, GERMANY +// Thorsten Horstmann +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the +// Free Software Foundation, Inc., +// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +/** \file + \brief Scheduler ConsoleDir internal header */ + +#ifndef IH_SENF_Scheduler_ConsoleDir_ +#define IH_SENF_Scheduler_ConsoleDir_ 1 + +// Custom includes +#include + +//-///////////////////////////////////////////////////////////////////////////////////////////////// + +namespace senf { +namespace scheduler { +namespace detail { + + class ConsoleDirManager + : public singleton + { + public: + using singleton::instance; + using singleton::alive; + + console::ScopedDirectory<> & consoleDir(); + + private: + ConsoleDirManager(); + + console::LazyDirectory consoleDir_; + + friend class singleton; + }; + +}}} + +//-///////////////////////////////////////////////////////////////////////////////////////////////// +#endif + + +// Local Variables: +// mode: c++ +// fill-column: 100 +// comment-column: 40 +// c-file-style: "senf" +// indent-tabs-mode: nil +// ispell-local-dictionary: "american" +// compile-command: "scons -u test" +// End: diff --git a/senf/Scheduler/EventManager.cc b/senf/Scheduler/EventManager.cc index ddd4e23..3c20571 100644 --- a/senf/Scheduler/EventManager.cc +++ b/senf/Scheduler/EventManager.cc @@ -31,7 +31,7 @@ #include #include #include -#include +#include "ConsoleDir.hh" #include "FIFORunner.hh" //#include "EventManager.mpp" @@ -41,8 +41,8 @@ prefix_ senf::scheduler::detail::EventManager::EventManager() { #ifndef SENF_DISABLE_CONSOLE - consoleDir_().add("events", senf::console::factory::Command( - senf::membind(&EventManager::listEvents, this)) + consoleDir().add("events", console::factory::Command( + membind(&EventManager::listEvents, this)) .doc("List all scheduler events sorted by priority\n" "\n" "Columns:\n" @@ -60,8 +60,6 @@ prefix_ senf::scheduler::detail::EventManager::EventManager() " - event disabled\n" " INFO further event specific information") ); - - senf::console::sysdir().add("scheduler", consoleDir_()); #endif } diff --git a/senf/Scheduler/EventManager.hh b/senf/Scheduler/EventManager.hh index c6983ba..a511b47 100644 --- a/senf/Scheduler/EventManager.hh +++ b/senf/Scheduler/EventManager.hh @@ -32,7 +32,6 @@ #include #include #include -#include //#include "EventManager.mpp" //-///////////////////////////////////////////////////////////////////////////////////////////////// @@ -115,10 +114,6 @@ namespace detail { EventList events_; friend class singleton; - -#ifndef SENF_DISABLE_CONSOLE - console::LazyDirectory consoleDir_; -#endif }; }}} diff --git a/senf/Scheduler/FIFORunner.cc b/senf/Scheduler/FIFORunner.cc index 85e98e3..ad58520 100644 --- a/senf/Scheduler/FIFORunner.cc +++ b/senf/Scheduler/FIFORunner.cc @@ -30,15 +30,18 @@ #include #include #include -#include -#include #ifdef SENF_DEBUG #include #endif #include #include #include +#include +#include #include "senf/Utils/IgnoreValue.hh" +#include +#include +#include "ConsoleDir.hh" //#include "FIFORunner.mpp" #define prefix_ @@ -71,12 +74,38 @@ prefix_ senf::scheduler::detail::FIFORunner::FIFORunner() tasks_.push_back(highPriorityEnd_); tasks_.push_back(normalPriorityEnd_); + +#ifndef SENF_DISABLE_CONSOLE + namespace fty = console::factory; + consoleDir().add("abortOnWatchdocTimeout", fty::Command( + SENF_MEMBINDFNP( bool, FIFORunner, abortOnTimeout, () const )) + .doc("Get current watchdog abort on event status.") ); + consoleDir().add("abortOnWatchdocTimeout", fty::Command( + SENF_MEMBINDFNP( void, FIFORunner, abortOnTimeout, (bool) )) + .doc("Enable/disable abort on watchdog event.") ); + consoleDir().add("watchdogTimeout", fty::Command( + SENF_MEMBINDFNP( unsigned, FIFORunner, taskTimeout, () const )) + .doc("Get current watchdog timeout in milliseconds") ); + consoleDir().add("watchdogTimeout", fty::Command( + SENF_MEMBINDFNP( void, FIFORunner, taskTimeout, (unsigned) )) + .doc("Set watchdog timeout to in milliseconds\n" + "Setting the watchdog timeout to 0 will disable the watchdog.") ); + consoleDir().add("watchdogEvents", fty::Command(membind( &FIFORunner::hangCount, this)) + .doc("Get number of occurred watchdog events.\n" + "Calling this method will reset the counter to 0") ); +#endif } prefix_ senf::scheduler::detail::FIFORunner::~FIFORunner() { timer_delete(watchdogId_); signal(SIGURG, SIG_DFL); + +#ifndef SENF_DISABLE_CONSOLE + consoleDir().remove("abortOnWatchdocTimeout"); + consoleDir().remove("watchdogTimeout"); + consoleDir().remove("watchdogEvents"); +#endif } prefix_ void senf::scheduler::detail::FIFORunner::startWatchdog() diff --git a/senf/Scheduler/Scheduler.hh b/senf/Scheduler/Scheduler.hh index 135c612..63b689e 100644 --- a/senf/Scheduler/Scheduler.hh +++ b/senf/Scheduler/Scheduler.hh @@ -69,8 +69,8 @@ namespace senf { \li senf::scheduler::SignalEvent for UNIX signal events \li senf::scheduler::EventHook for a special event hook - These instance are owned and managed by the user of the scheduler \e not by the scheduler so the - RAII concept can be used. + These instance are owned and managed by the user of the %scheduler \e not by the %scheduler so + the RAII concept can be used. \code class SomeServer @@ -95,7 +95,7 @@ namespace senf { The event is defined as a class member variable. When the event member is initialized in the constructor, the event is automatically registered (except if the optional \a initiallyEnabled flag argument is set to \c false). The Destructor will automatically remove the event from the - scheduler and ensure, that no dead code is called accidentally. + %scheduler and ensure, that no dead code is called accidentally. The process is the same for the other event types or when registering multiple events. For detailed information on the constructor arguments and other features see the event class @@ -141,7 +141,7 @@ namespace senf { \section sched_exec Executing the Scheduler - To enter the scheduler main-loop, call + To enter the %scheduler main-loop, call \code senf::scheduler::process(); @@ -202,7 +202,7 @@ namespace senf { To secure against blocking callbacks, the %scheduler implementation includes a watchdog timer. This timer will produce a warning message on the standard error stream when a single - callback is executing for more than the watchdog timeout value. Since the scheduler + callback is executing for more than the watchdog timeout value. Since the %scheduler implementation is completely single threaded, we cannot terminate the callback but at least we can produce an informative message and optionally the program can be aborted. diff --git a/senf/Utils/Daemon/Daemon.cc b/senf/Utils/Daemon/Daemon.cc index ec9bd58..0923647 100644 --- a/senf/Utils/Daemon/Daemon.cc +++ b/senf/Utils/Daemon/Daemon.cc @@ -69,7 +69,7 @@ prefix_ senf::Daemon::~Daemon() if (pidfileCreated_) { try { LIBC_CALL( ::unlink, (pidfile_.c_str()) ); - } catch (Exception e) { + } catch (Exception & e) { // e << "; could not unlink " << pidfile_.c_str(); // throw; } diff --git a/senf/Utils/Logger/Definitions.ih b/senf/Utils/Logger/Definitions.ih index 1e81d28..b7d8446 100644 --- a/senf/Utils/Logger/Definitions.ih +++ b/senf/Utils/Logger/Definitions.ih @@ -33,7 +33,7 @@ // Implementation details concerning SENF_LOG_CLASS_AREA // // The SENF_LOG_CLASS_AREA statement shall declare the containing class as it's own default area. Of -// course, we cannot make the containing class into an area. Therefor we need to trick around a bit: +// course, we cannot make the containing class into an area. Therefore we need to trick around a bit: // // We begin by defining an area SENFLogArea with in the class. This area however is hacked, so that // it's name() member will return the name of the containing class (which is simple: just cut of the diff --git a/senf/Utils/Logger/SyslogTarget.hh b/senf/Utils/Logger/SyslogTarget.hh index 03032b1..03436ac 100644 --- a/senf/Utils/Logger/SyslogTarget.hh +++ b/senf/Utils/Logger/SyslogTarget.hh @@ -42,7 +42,7 @@ namespace log { /** \brief Log target writing to the syslog - The SyslogTarget will send all log messages to the syslog at the given facility. + The SyslogTarget will send all %log messages to the syslog at the given facility. \code senf::log::SyslogTarget syslog; diff --git a/site_scons/SparseTestHack.py b/site_scons/SparseTestHack.py index 319ee28..025bb6b 100644 --- a/site_scons/SparseTestHack.py +++ b/site_scons/SparseTestHack.py @@ -6,7 +6,7 @@ import SCons.Node, SCons.Node.FS, SCons.Util, SCons.Errors, os # files needed explicitly. # # This works by building a list of all children (recursively) of the -# test sources. For each child we check, wether a file with the same +# test sources. For each child we check, whether a file with the same # name but an $OBJSUFFIX extension exists as a build target. In that # case, we add it to the list of needed objects (AND recursively scan # that objects children). diff --git a/tools/senf.dict b/tools/senf.dict index c0bee47..e35314e 100644 --- a/tools/senf.dict +++ b/tools/senf.dict @@ -220,6 +220,7 @@ FooException FooParser ForwardingRoute ForwardRange +fragmentation fraunhofer FroblizerArea fsiCe @@ -247,6 +248,7 @@ hexdump hh hideinitializer Hmm +horstmann hostname hostnames howto @@ -502,6 +504,7 @@ PriorityJoin protocolbundle protocolbundles protocolType +proxy ptr PUSHD py @@ -732,6 +735,3 @@ www xmlsoft XSLT xsltproc -xxxx -xxxxxx -xyz