def report(self, stream):
        table = []
        for test, b_vm, b_sru_maxrss, b_cru_maxrss, a_vm, a_sru_maxrss, a_cru_maxrss, children  \
                in self._profiled_tests:
            # printable tid: don't need the full path
            ptid = ".".join(test.split(".")[-2:])

            table.append([ptid, ""])
            table.append(["", "Before: self maxrss=%s, children maxrss=%s" % (b_sru_maxrss, b_cru_maxrss)])
            table.append(["", "%s" % str(b_vm)])
            table.append(["", "After : self maxrss=%s, children maxrss=%s" % (a_sru_maxrss, a_cru_maxrss)])
            table.append(["", "%s" % str(a_vm)])
            table.append(["", "Diff  : self maxrss=%s, children maxrss=%s" % (str(a_sru_maxrss - b_sru_maxrss),
                str(a_cru_maxrss - b_cru_maxrss))])
            table.append(["", children % "%s"])
            table.append(["", ""])

        # header
        table.insert(0, ['Test', 'Memory Stats: maxrss in KB(linux2) or Bytes(darwin), vmem in Bytes'])

        # get widths
        widths = [max([len(row[x]) for row in table]) for x in xrange(len(table[0]))]
        fmt_out = [" ".join([x.ljust(widths[i]) for i, x in enumerate(row)]) for row in table]

        # insert col separation row
        fmt_out.insert(1, " ".join([''.ljust(widths[i], '=') for i in xrange(len(widths))]))

        # write this all to sstream
        stream.write("Memory report\n")

        stream.write("\n".join(fmt_out))
        stream.write("\n")
dataset/ETHPy150Open ooici/pyon/pyon/util/memory_plugin.py/MemProfile.report/swapped operands of `%`