X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Scheduler%2FEventManager.cc;h=d267a1ee818515d206ed5b42d31fdee64e64f3de;hb=bd9f9d3fd6fbcff0112a7bf48ab9284da9576b11;hp=0743cb69fba078e87d087166b21d375d83c024c8;hpb=2da517bbcdb2af10d2322fc762ca27774b53b435;p=senf.git diff --git a/Scheduler/EventManager.cc b/Scheduler/EventManager.cc index 0743cb6..d267a1e 100644 --- a/Scheduler/EventManager.cc +++ b/Scheduler/EventManager.cc @@ -29,7 +29,7 @@ // Custom includes #include #include "../Utils/membind.hh" -#include "Console/Console.hh" +#include "../Utils/Console/Console.hh" #include "FIFORunner.hh" //#include "EventManager.mpp" @@ -39,31 +39,59 @@ prefix_ senf::scheduler::detail::EventManager::EventManager() { #ifndef SENF_DISABLE_CONSOLE - consoleDir_().add("events", senf::membind(&EventManager::consoleEvents, this)); + consoleDir_().add("events", senf::membind(&EventManager::listEvents, this)) + .doc("List all scheduler events sorted by priority\n" + "\n" + "Columns:\n" + " TP event type:\n" + " fd file descriptor\n" + " tm timer\n" + " si UNIX signal\n" + " ee event hook\n" + " NAME descriptive event name\n" + " ADDRESS address of event class instance\n" + " RUNCNT number of times, the event was called\n" + " S state:\n" + " R runnable\n" + " W waiting\n" + " - event disabled\n" + " INFO further event specific information"); + senf::console::sysdir().add("scheduler", consoleDir_()); #endif } -prefix_ void senf::scheduler::detail::EventManager::consoleEvents(std::ostream & os) +prefix_ void senf::scheduler::detail::EventManager::listEvents(std::ostream & os) { - iterator i (begin()); - iterator const i_end (end()); - // On an 80 column display, this wraps nicely directly before the RUN column - os << boost::format("%-6s %-52s %-10s %-8s %7s %s\n") - % "TYPE" - % "NAME" - % "ADDRESS" - % "ACTIVE?" - % "RUN" - % "INFO"; - for (; i != i_end; ++i) - os << boost::format("%-6.6s %-52.52s 0x%08x %-8.8s %7d %s\n") - % i->type() - % i->name() - % reinterpret_cast(&(*i)) - % (i->enabled() ? "enabled" : "disabled") - % i->runCount() - % i->info(); + // On an 80 column display, this wraps nicely directly before the INFO column + boost::format fmt ("%s %-55.55s 0x%08x %8d %s %s\n"); + os << boost::format("%s %-55.55s %-10s %8s %s %s\n") + % "TP" % "NAME" % "ADDRESS" % "RUNCNT" % "S" % "INFO"; + { + FIFORunner::iterator i (FIFORunner::instance().begin()); + FIFORunner::iterator const i_end (FIFORunner::instance().end()); + for (; i != i_end; ++i) + os << fmt + % i->type() + % i->name() + % reinterpret_cast(&(*i)) + % i->runCount() + % (i->runnable() ? "R" : "W") + % i->info(); + } + { + iterator i (begin()); + iterator const i_end (end()); + for (; i != i_end; ++i) + if (! i->enabled()) + os << fmt + % i->type() + % i->name() + % reinterpret_cast(&(*i)) + % i->runCount() + % "-" + % i->info(); + } } ///////////////////////////////cc.e////////////////////////////////////////