added scheduler watchdog members to sys/scheduler console dir
tho [Tue, 8 Mar 2011 14:43:47 +0000 (14:43 +0000)]
fixed some typos

git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1771 270642c3-0616-0410-b53a-bc976706d245

12 files changed:
senf/Scheduler/ConsoleDir.cc [new file with mode: 0644]
senf/Scheduler/ConsoleDir.hh [new file with mode: 0644]
senf/Scheduler/ConsoleDir.ih [new file with mode: 0644]
senf/Scheduler/EventManager.cc
senf/Scheduler/EventManager.hh
senf/Scheduler/FIFORunner.cc
senf/Scheduler/Scheduler.hh
senf/Utils/Daemon/Daemon.cc
senf/Utils/Logger/Definitions.ih
senf/Utils/Logger/SyslogTarget.hh
site_scons/SparseTestHack.py
tools/senf.dict

diff --git a/senf/Scheduler/ConsoleDir.cc b/senf/Scheduler/ConsoleDir.cc
new file mode 100644 (file)
index 0000000..ac0d2a9
--- /dev/null
@@ -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 <tho@berlios.de>
+//
+// 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 <senf/Utils/Console/ScopedDirectory.hh>
+#include <senf/Utils/Console/Sysdir.hh>
+
+#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_
+
+\f
+// 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 (file)
index 0000000..135b537
--- /dev/null
@@ -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 <tho@berlios.de>
+//
+// 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 <senf/Utils/Console/LazyDirectory.hh>
+
+//#include "Sysdir.mpp"
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace senf {
+namespace scheduler {
+
+    console::ScopedDirectory<> & consoleDir();
+
+}}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+//#include "ConsoleDir.cci"
+//#include "ConsoleDir.ct"
+//#include "ConsoleDir.cti"
+#endif
+
+\f
+// 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 (file)
index 0000000..394322d
--- /dev/null
@@ -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 <tho@berlios.de>
+//
+// 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 <senf/Utils/singleton.hh>
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+
+namespace senf {
+namespace scheduler {
+namespace detail {
+
+    class ConsoleDirManager
+        : public singleton<ConsoleDirManager>
+    {
+    public:
+        using singleton<ConsoleDirManager>::instance;
+        using singleton<ConsoleDirManager>::alive;
+
+        console::ScopedDirectory<> & consoleDir();
+
+    private:
+        ConsoleDirManager();
+
+        console::LazyDirectory consoleDir_;
+
+        friend class singleton<ConsoleDirManager>;
+    };
+
+}}}
+
+//-/////////////////////////////////////////////////////////////////////////////////////////////////
+#endif
+
+\f
+// 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:
index ddd4e23..3c20571 100644 (file)
@@ -31,7 +31,7 @@
 #include <senf/Utils/membind.hh>
 #include <senf/Utils/Console/ScopedDirectory.hh>
 #include <senf/Utils/Console/ParsedCommand.hh>
-#include <senf/Utils/Console/Sysdir.hh>
+#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
 }
 
index c6983ba..a511b47 100644 (file)
@@ -32,7 +32,6 @@
 #include <senf/boost_intrusive/ilist.hpp>
 #include <senf/boost_intrusive/ilist_hook.hpp>
 #include <senf/Utils/singleton.hh>
-#include <senf/Utils/Console/LazyDirectory.hh>
 
 //#include "EventManager.mpp"
 //-/////////////////////////////////////////////////////////////////////////////////////////////////
@@ -115,10 +114,6 @@ namespace detail {
         EventList events_;
 
         friend class singleton<EventManager>;
-
-#ifndef SENF_DISABLE_CONSOLE
-        console::LazyDirectory consoleDir_;
-#endif
     };
 
 }}}
index 85e98e3..ad58520 100644 (file)
 #include <signal.h>
 #include <time.h>
 #include <cassert>
-#include <senf/Utils/Exception.hh>
-#include <senf/Utils/senfassert.hh>
 #ifdef SENF_DEBUG
     #include <execinfo.h>
 #endif
 #include <senf/config.hh>
 #include <stdint.h>
 #include <stdio.h>
+#include <senf/Utils/Exception.hh>
+#include <senf/Utils/senfassert.hh>
 #include "senf/Utils/IgnoreValue.hh"
+#include <senf/Utils/Console/ScopedDirectory.hh>
+#include <senf/Utils/Console/ParsedCommand.hh>
+#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()
index 135c612..63b689e 100644 (file)
@@ -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.
 
index ec9bd58..0923647 100644 (file)
@@ -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;
         }
index 1e81d28..b7d8446 100644 (file)
@@ -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
index 03032b1..03436ac 100644 (file)
@@ -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;
index 319ee28..025bb6b 100644 (file)
@@ -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).
index c0bee47..e35314e 100644 (file)
@@ -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