def cputest(self, time=10, rate=512):
        ''' Run MGEN through a chain of nodes and report the CPU usage and
            percent of lost packets. Rate is in kbps.
        '''
        if self.verbose:
            self.info("%s initial test ping (max 1 second)..." % \
                      self.firstnode.name)
        (status, result) = self.firstnode.cmdresult(["ping", "-q", "-c", "1",
                                                     "-w", "1", self.lastaddr])
        if status != 0:
            self.warn("initial ping from %s to %s failed! result:\n%s" % \
                      (self.firstnode.name, self.lastaddr, result))
            return (0.0, 0.0)
        lines = readstat()
        cpustart = getcputimes(lines[0])
        loss = MgenCmd(node=self.lastnode, client_node=self.firstnode,
                       verbose=False, addr=self.lastaddr,
                       time=time, rate=rate).run()
        lines = readstat()
        cpuend = getcputimes(lines[0])
        percent = calculatecpu(cpustart, cpuend)
        self.info((percent, loss) % "CPU usage (%%): %.02f, %.02f loss")
        return percent, loss
dataset/ETHPy150Open coreemu/core/daemon/examples/netns/wlanemanetests.py/Experiment.cputest/swapped operands of `%`