X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=PPI%2FConnectors.cc;h=ce44e0d23784c73237c77ee2ba399303fb61d9a6;hb=d5a72d0b3f6fee56dba6de1c54cafb448ebe3457;hp=46c762ef3ee9418c7ff812887107203c66b6b87a;hpb=931569b3c9783a06e432471515980d1d02aa0b54;p=senf.git diff --git a/PPI/Connectors.cc b/PPI/Connectors.cc index 46c762e..ce44e0d 100644 --- a/PPI/Connectors.cc +++ b/PPI/Connectors.cc @@ -84,15 +84,25 @@ prefix_ void senf::ppi::connector::Connector::trace(Packet const & p, char const return; SENF_LOG_BLOCK(({ std::string type (prettyName(p.typeId().id())); - log << "PPI trace: 0x" << std::hex << p.id() << " " - << type.substr(21, type.size()-22) << " " << label - << " on " << & module() << " " << prettyName(typeid(module())) - << " connector 0x" << this << "\n"; + log << "PPI packet trace: " << label << " 0x" << std::hex << p.id() << " " + << type.substr(21, type.size()-22) << " on " << & module() << " " + << prettyName(typeid(module())) << " connector 0x" << this << "\n"; if (traceState_ == TRACE_CONTENTS) p.dump(log); })); } +prefix_ void senf::ppi::connector::Connector::throttleTrace(char const * label, + char const * type) +{ + if (traceState_ == NO_TRACING) + return; + SENF_LOG_BLOCK(({ + log << "PPI throttling trace: " << label << " " << type << " on " << & module() + << " " << prettyName(typeid(module())) << " connector 0x" << this << "\n"; + })); +} + namespace senf { namespace ppi { namespace connector { SENF_CONSOLE_REGISTER_ENUM_MEMBER( @@ -109,9 +119,9 @@ namespace { ConsoleRegister::ConsoleRegister() { - senf::console::sysdir() - .add("ppiTracing", SENF_FNP(senf::ppi::connector::Connector::TraceState, - senf::ppi::connector::Connector::tracing, ())) + senf::ppi::ModuleManager::instance().consoleDir() + .add("tracing", SENF_FNP(senf::ppi::connector::Connector::TraceState, + senf::ppi::connector::Connector::tracing, ())) .doc("Log every packet sent or received by any module.\n" "There are three different tracing levels:\n" "\n" @@ -122,24 +132,27 @@ namespace { "A log message is generated whenever the packet traverses a connector. The\n" "TRACE_IDS log message has the following format:\n" "\n" - " PPI trace: \n" + " PPI packet trace: \n" + " on connector \n" + " PPI throttling trace: \n" " on connector \n" "\n" "The fields are:\n" "\n" + " direction 'IN' for packets/throttle notifications entering the module,\n" + " 'OUT' for packets/throttle notifications leaving it\n" " packet-id Numeric unique packet id. This value is unique for packets\n" " alive at the same time, packets at different times may (and\n" " will) share id's\n" " packet-type The type of the packet header\n" - " direction 'INCOMING' for packets entering the module, 'OUTGOING' for\n" - " packets leaving it\n" " module-id Unique module id\n" " module-type Type of the module the packet is sent to/from\n" - " connector-id Unique connector id\n"); + " connector-id Unique connector id\n" + " throttle-msg Type of throttling event\n"); - senf::console::sysdir() - .add("ppiTracing", SENF_FNP(void, senf::ppi::connector::Connector::tracing, - (senf::ppi::connector::Connector::TraceState))) + senf::ppi::ModuleManager::instance().consoleDir() + .add("tracing", SENF_FNP(void, senf::ppi::connector::Connector::tracing, + (senf::ppi::connector::Connector::TraceState))) .arg("state", "new tracing state"); } @@ -198,7 +211,8 @@ prefix_ void senf::ppi::connector::PassiveConnector::notifyUnthrottle() remoteThrottled_ = false; if (!nativeThrottled_) emitUnthrottle(); - } + } else + throttleTrace("OUT", "not forwarding unthrottle event"); } /////////////////////////////////////////////////////////////////////////// @@ -215,6 +229,7 @@ prefix_ void senf::ppi::connector::ActiveConnector::v_init() prefix_ void senf::ppi::connector::ActiveConnector::notifyThrottle() { + throttleTrace("IN ", "throttle"); if (! throttled_) { throttled_ = true; if (throttleCallback_) @@ -228,6 +243,7 @@ prefix_ void senf::ppi::connector::ActiveConnector::notifyThrottle() prefix_ void senf::ppi::connector::ActiveConnector::notifyUnthrottle() { + throttleTrace("IN ", "unthrottle"); if (throttled_) { throttled_ = false; if (unthrottleCallback_) @@ -257,7 +273,7 @@ prefix_ senf::Packet senf::ppi::connector::InputConnector::operator()() queue_.pop_back(); v_dequeueEvent(); } - trace(p, "INCOMING"); + trace(p, "IN "); return p; }