Exemple #1
0
    def nstats(self, source, target, args):
        """Display current network stats

        Syntax: NSTATS
        """

        bytesin, bytesout = self.parent.data["bytes"]
        bytestotal = bytesin + bytesout

        msg = "Traffic: {0:s} / {1:s} ({2:s})".format(
            "{0:0.2f}{1:s}".format(*bytes(bytesin)),
            "{0:0.2f}{1:s}".format(*bytes(bytesout)),
            "{0:0.2f}{1:s}".format(*bytes(bytestotal)),
        )

        return msg
Exemple #2
0
    def mstats(self, source, target, args):
        """Display current memory stats

        Syntax: MSTATS
        """

        m = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
        if "linux" in platform:
            m *= 1024  # KB -> Bytes

        msg = "Memory Usage: {0:s}".format(
            "{0:0.2f}{1:s}".format(*bytes(m))
        )

        return msg