From: tho Date: Fri, 22 Oct 2010 12:45:27 +0000 (+0000) Subject: PPI: output throttle state on ppi-dump X-Git-Url: http://g0dil.de/git?a=commitdiff_plain;h=6659457baa07c4f1a2e0d4eae20f2727520f8039;p=senf.git PPI: output throttle state on ppi-dump git-svn-id: https://svn.berlios.de/svnroot/repos/senf/trunk@1738 270642c3-0616-0410-b53a-bc976706d245 --- diff --git a/senf/PPI/ModuleManager.cc b/senf/PPI/ModuleManager.cc index bafcb48..82aef9d 100644 --- a/senf/PPI/ModuleManager.cc +++ b/senf/PPI/ModuleManager.cc @@ -84,15 +84,16 @@ prefix_ senf::ppi::ModuleManager::ModuleManager() "The dump will contain one paragraph for each module. The first line gives module\n" "information, additional lines list all connectors and their peers (if connected).\n" "\n" - "This information can be processed by 'PPI/drawmodules.py' and 'dot' (from the\n" + "This information can be processed by 'tools/drawmodules.py' and 'dot' (from the\n" "graphviz package) to generate a graphic representation of the module structure:\n" "\n" " $ echo /sys/ppi/dump | nc -q1 \\\n" - " | python PPI/drawmodules.py | dot -Tpng /dev/fd/0 >modules.png\n") + " | python tools/drawmodules.py | dot -Tpng /dev/fd/0 >modules.png\n") ); } prefix_ void senf::ppi::ModuleManager::dumpModules(std::ostream & os) + const { for (ModuleRegistry::const_iterator i (moduleRegistry_.begin()), i_end (moduleRegistry_.end()); i != i_end; ++i) { @@ -100,8 +101,12 @@ prefix_ void senf::ppi::ModuleManager::dumpModules(std::ostream & os) for (module::Module::ConnectorRegistry::iterator j ((*i)->connectorRegistry_.begin()), j_end ((*i)->connectorRegistry_.end()); j != j_end; ++j) { os << " " << *j << " " << prettyName(typeid(**j)); - if ((**j).connected()) + if ((**j).connected()) { os << " " << & (*j)->peer(); + connector::PassiveConnector * pc (dynamic_cast(*j)); + if (pc && pc->throttled()) + os << " throttled"; + } os << "\n"; } os << "\n"; diff --git a/senf/PPI/ModuleManager.hh b/senf/PPI/ModuleManager.hh index 6d22dc6..9512721 100644 --- a/senf/PPI/ModuleManager.hh +++ b/senf/PPI/ModuleManager.hh @@ -95,7 +95,7 @@ namespace ppi { void unregisterInitializable(Initializable & i); bool initializableRegistered(Initializable const & i) const; - void dumpModules(std::ostream & os); + void dumpModules(std::ostream & os) const; typedef std::vector ModuleRegistry; typedef std::deque InitQueue; diff --git a/senf/Utils/Logger/Target.cc b/senf/Utils/Logger/Target.cc index be8d148..f73a8e4 100644 --- a/senf/Utils/Logger/Target.cc +++ b/senf/Utils/Logger/Target.cc @@ -75,7 +75,7 @@ prefix_ senf::log::Target::Target(std::string const & name) .add("route", fty::Command(&Target::consoleRoute, this) .arg("index", "index at which to insert new rule") .arg("parameters", "log parameters. The log parameters select the log stream, log area\n" - " and log level. You may specify any combination of these parameterse\n" + " and log level. You may specify any combination of these parameters\n" " in any order. Use the '/sys/log/stream' and '/sys/log/areas' commands\n" " to list all valid streams and areas. Valid log levels are:\n" " VERBOSE NOTICE MESSAGE IMPORTANT CRITICAL FATAL") @@ -415,7 +415,7 @@ prefix_ senf::log::detail::TargetRegistry::TargetRegistry() consoleDir_() .add("message", fty::Command(&TargetRegistry::consoleWrite, this) .arg("parameters", "log parameters. The log parameters select the log stream, log area\n" - " and log level. You may specify any combination of these parameterse\n" + " and log level. You may specify any combination of these parameters\n" " in any order. Use the '/sys/log/stream' and '/sys/log/areas' commands\n" " to list all valid streams and areas. Valid log levels are:\n" " VERBOSE NOTICE MESSAGE IMPORTANT CRITICAL FATAL", diff --git a/tools/drawmodules.py b/tools/drawmodules.py index 4926d8b..8ae7288 100755 --- a/tools/drawmodules.py +++ b/tools/drawmodules.py @@ -32,19 +32,24 @@ for line in sys.stdin: else: connectorid, type = line.split(' ',1); connectorid = connectorid[1:] - - packet = type.rsplit('<',1)[1]; - packet = packet.rsplit('::',1)[-1]; - packet = packet.split('>',1)[0]; - - elts = type.rsplit(' ',1); + + packet = type.rsplit('<',1)[1] + packet = packet.rsplit('::',1)[-1] + packet = packet.split('>',1)[0] + + throttled = False + elts = type.rsplit(' ', 1); if elts[-1].startswith('0x'): - type, peerid = elts - peerid = peerid[1:] + type, peerid = elts[0], elts[1][1:] else: - peerid = None + if elts[-1] == ('throttled'): + throttled = True + elts = elts[0].rsplit(' ', 1) + type, peerid = elts[0], elts[1][1:] + else: + peerid = None modules[moduleid][1].append((connectorid, type, peerid, packet)) - connectors[connectorid] = moduleid + connectors[connectorid] = (moduleid, throttled) for moduleid, (module, cs) in modules.iteritems(): module = module.split('<',1)[0] @@ -59,12 +64,12 @@ for moduleid, (module, cs) in modules.iteritems(): module = module.rsplit('::',1)[-1] inputs = [] outputs = [] - for connectorid, type, peerid,packet in cs: + for connectorid, type, peerid, packet in cs: if 'Input' in type: inputs.append("<%s>%s" % (connectorid,connectorid)) else: outputs.append("<%s>%s" % (connectorid,connectorid)) rows = [] if inputs: rows.append("{%s}" % "|".join(inputs)) - rows.append("%s (%s)" % (module, moduleid)) + rows.append("%s" % (module)) if outputs: rows.append("{%s}" % "|".join(outputs)) sys.stdout.write('%s [label="{%s}" style="filled" fillcolor="/%s/%s" ]\n' % (moduleid, "|".join(rows),COLOR_SCHEME, color )) @@ -75,15 +80,22 @@ for moduleid, (type, cs) in modules.iteritems(): for connectorid, type, peerid, packet in cs: opts = [] if "Passive" in type: opts.append("arrowtail=odot"); + if "Output" in type and peerid is not None: + if "Active" in type and connectors[peerid][1]: + opts.append("arrowhead=tee") + opts.append('headlabel="!"') + if "Passive" in type and connectors[connectorid][1]: + opts.append("arrowtail=tee") + opts.append('taillabel="!"') opts = ",".join(opts) if opts: opts = " [%s]" % opts if "Output" in type and peerid is not None: - if "Packet" in packet and p is 1: - sys.stdout.write('%s:%s -> %s:%s%s [label=" %s", fontsize=8, fontname="Helvetica"]\n' - % (moduleid, connectorid, connectors[peerid], peerid, opts,packet)) - else: - sys.stdout.write('%s:%s -> %s:%s%s\n' - % (moduleid, connectorid, connectors[peerid], peerid, opts)) + if "Packet" in packet and p is 1: + sys.stdout.write('%s:%s -> %s:%s%s [label=" %s", fontsize=8, fontname="Helvetica"]\n' + % (moduleid, connectorid, connectors[peerid][0], peerid, opts,packet)) + else: + sys.stdout.write('%s:%s -> %s:%s%s\n' + % (moduleid, connectorid, connectors[peerid][0], peerid, opts)) elif peerid is None: sys.stdout.write('anon%d [label="", shape=point, height=.05];\n' % anonid) if "Output" in type: