How to use the pympler.util.stringutils.pp_timestamp function in Pympler

To help you get started, we’ve selected a few Pympler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github lrq3000 / pyFileFixity / pyFileFixity / lib / profilers / visual / pympler / classtracker_stats.py View on Github external
self._print_refs(fobj, merged.refs, merged.size)
                else:
                    fobj.write('<p>No per-referent sizes recorded.</p>\n')

        fobj.write("<h2>Instances</h2>\n")
        for tobj in self.index[classname]:
            fobj.write('\n')
            fobj.write('\n' % (tobj.name, tobj.id))
            if tobj.repr:
                fobj.write("\n" % tobj.repr)
            fobj.write("\n" % (pp_timestamp(tobj.birth), pp_timestamp(tobj.death)))
            if tobj.trace:
                trace = "<pre>%s</pre><table width="100%" id="tl"><tbody><tr><td width="140px" id="hl">Instance</td><td id="hl">%s at 0x%08x</td></tr><tr><td>Representation</td><td>%s&nbsp;</td></tr><tr><td>Lifetime</td><td>%s - %s</td></tr><tr><td>Instantiation</td><td>%s</td></tr><tr><td>%s</td><td>%s</td></tr><tr><td>%s" % pp(size.size))
                    self._print_refs(fobj, size.refs, size.size)
                    fobj.write("</td></tr></tbody></table>" % (_format_trace(tobj.trace))
                fobj.write("\n" % trace)
            for (timestamp, size) in tobj.snapshots:
                fobj.write("" % pp_timestamp(timestamp))
                if not size.refs:
                    fobj.write("\n" % pp(size.size))
                else:
                    fobj.write("\n")
            fobj.write("\n")

        fobj.write(self.footer)
        fobj.close()
github lrq3000 / pyFileFixity / pyFileFixity / lib / profilers / visual / pympler / classtracker_stats.py View on Github external
Print the gathered information of object `tobj` in human-readable format.
        """
        if tobj.death:
            self.stream.write('%-32s ( free )   %-35s\n' % (
                trunc(tobj.name, 32, left=1), trunc(tobj.repr, 35)))
        else:
            self.stream.write('%-32s 0x%08x %-35s\n' % (
                trunc(tobj.name, 32, left=1),
                tobj.id,
                trunc(tobj.repr, 35)
            ))
        if tobj.trace:
            self.stream.write(_format_trace(tobj.trace))
        for (timestamp, size) in tobj.snapshots:
            self.stream.write('  %-30s %s\n' % (
                pp_timestamp(timestamp), pp(size.size)
            ))
            self._print_refs(size.refs, size.size)
        if tobj.death is not None:
            self.stream.write('  %-30s finalize\n' % (
                pp_timestamp(tobj.death),
            ))
github lrq3000 / pyFileFixity / pyFileFixity / lib / profilers / visual / pympler / classtracker_stats.py View on Github external
merged = snapshot.classes[classname]['merged']
                fobj.write(self.class_snapshot % {
                    'name': snapshot.desc, 'cls':classname, 'total': pp(merged.size)
                })
                if merged.refs:
                    self._print_refs(fobj, merged.refs, merged.size)
                else:
                    fobj.write('<p>No per-referent sizes recorded.</p>\n')

        fobj.write("<h2>Instances</h2>\n")
        for tobj in self.index[classname]:
            fobj.write('\n')
            fobj.write('\n' % (tobj.name, tobj.id))
            if tobj.repr:
                fobj.write("\n" % tobj.repr)
            fobj.write("\n" % (pp_timestamp(tobj.birth), pp_timestamp(tobj.death)))
            if tobj.trace:
                trace = "<pre>%s</pre><table width="100%" id="tl"><tbody><tr><td width="140px" id="hl">Instance</td><td id="hl">%s at 0x%08x</td></tr><tr><td>Representation</td><td>%s&nbsp;</td></tr><tr><td>Lifetime</td><td>%s - %s</td></tr><tr><td>Instantiation</td><td>%s</td></tr><tr><td>%s</td><td>%s</td></tr><tr><td>%s" % pp(size.size))
                    self._print_refs(fobj, size.refs, size.size)
                    fobj.write("</td></tr></tbody></table>" % (_format_trace(tobj.trace))
                fobj.write("\n" % trace)
            for (timestamp, size) in tobj.snapshots:
                fobj.write("" % pp_timestamp(timestamp))
                if not size.refs:
                    fobj.write("\n" % pp(size.size))
                else:
                    fobj.write("\n")
            fobj.write("\n")

        fobj.write(self.footer)
        fobj.close()
github pympler / pympler / pympler / classtracker_stats.py View on Github external
for tobj in self.index[classname]:
            fobj.write('\n')
            fobj.write('' +
                       '\n' %
                       (tobj.name, tobj.id))
            if tobj.repr:
                fobj.write("" +
                           "\n" % tobj.repr)
            fobj.write("\n" %
                       (pp_timestamp(tobj.birth), pp_timestamp(tobj.death)))
            if tobj.trace:
                trace = "<pre>%s</pre><table width="100%" id="tl"><tbody><tr><td width="140px" id="hl">Instance</td><td id="hl">%s at 0x%08x</td></tr><tr><td>Representation</td><td>%s&nbsp;</td></tr><tr><td>Lifetime</td><td>%s - %s</td></tr><tr><td>Instantiation</td><td>%s</td></tr><tr><td>%s</td><td>%s</td></tr><tr><td>%s" % pp(size.size))
                    self._print_refs(fobj, size.refs, size.size)
                    fobj.write("</td></tr></tbody></table>" % (_format_trace(tobj.trace))
                fobj.write("\n" %
                           trace)
            for (timestamp, size) in tobj.snapshots:
                fobj.write("" % pp_timestamp(timestamp))
                if not size.refs:
                    fobj.write("\n" % pp(size.size))
                else:
                    fobj.write("\n")
            fobj.write("\n")

        fobj.write(self.footer)
        fobj.close()
github arjun-menon / Distributed-Graph-Algorithms / pympler / classtracker_stats.py View on Github external
merged = snapshot.classes[classname]['merged']
                fobj.write(self.class_snapshot % {
                    'name': snapshot.desc, 'cls':classname, 'total': pp(merged.size)
                })
                if merged.refs:
                    self._print_refs(fobj, merged.refs, merged.size)
                else:
                    fobj.write('<p>No per-referent sizes recorded.</p>\n')

        fobj.write("<h2>Instances</h2>\n")
        for tobj in self.index[classname]:
            fobj.write('\n')
            fobj.write('\n' % (tobj.name, tobj.id))
            if tobj.repr:
                fobj.write("\n" % tobj.repr)
            fobj.write("\n" % (pp_timestamp(tobj.birth), pp_timestamp(tobj.death)))
            if tobj.trace:
                trace = "<pre>%s</pre><table width="100%" id="tl"><tbody><tr><td width="140px" id="hl">Instance</td><td id="hl">%s at 0x%08x</td></tr><tr><td>Representation</td><td>%s&nbsp;</td></tr><tr><td>Lifetime</td><td>%s - %s</td></tr><tr><td>Instantiation</td><td>%s</td></tr><tr><td>%s</td><td>%s</td></tr><tr><td>%s" % pp(size.size))
                    self._print_refs(fobj, size.refs, size.size)
                    fobj.write("</td></tr></tbody></table>" % (_format_trace(tobj.trace))
                fobj.write("\n" % trace)
            for (timestamp, size) in tobj.snapshots:
                fobj.write("" % pp_timestamp(timestamp))
                if not size.refs:
                    fobj.write("\n" % pp(size.size))
                else:
                    fobj.write("\n")
            fobj.write("\n")

        fobj.write(self.footer)
        fobj.close()
github lrq3000 / pyFileFixity / pyFileFixity / lib / profilers / visual / pympler / classtracker_stats.py View on Github external
fobj.write("<h1>%s</h1>\n" % title)
        fobj.write("<h2>Memory distribution over time</h2>\n")
        fobj.write(self.charts['snapshots'])

        fobj.write("<h2>Snapshots statistics</h2>\n")
        fobj.write('\n')

        classlist = list(self.index.keys())
        classlist.sort()

        for snapshot in self.snapshots:
            fobj.write('<table id="nb"><tbody><tr><td>\n')
            fobj.write('\n')
            fobj.write("<h3>%s snapshot at %s</h3><a href="%s">%s</a><table id="tl"></table>\n" % (
                snapshot.desc or 'Untitled',
                pp_timestamp(snapshot.timestamp)
            ))

            data = {}
            data['sys']      = pp(snapshot.system_total.vsz)
            data['tracked']  = pp(snapshot.tracked_total)
            data['asizeof']  = pp(snapshot.asizeof_total)
            data['overhead'] = pp(getattr(snapshot, 'overhead', 0))

            fobj.write(self.snapshot_summary % data)

            if snapshot.tracked_total:
                fobj.write(self.snapshot_cls_header)
                for classname in classlist:
                    data = snapshot.classes[classname].copy()
                    data['cls'] = '' % (self.relative_path(self.links[classname]), classname)
                    data['sum'] = pp(data['sum'])</td></tr></tbody></table>
github arjun-menon / Distributed-Graph-Algorithms / pympler / classtracker_stats.py View on Github external
fobj.write("<h1>%s</h1>\n" % title)
        fobj.write("<h2>Memory distribution over time</h2>\n")
        fobj.write(self.charts['snapshots'])

        fobj.write("<h2>Snapshots statistics</h2>\n")
        fobj.write('\n')

        classlist = list(self.index.keys())
        classlist.sort()

        for snapshot in self.snapshots:
            fobj.write('<table id="nb"><tbody><tr><td>\n')
            fobj.write('\n')
            fobj.write("<h3>%s snapshot at %s</h3><a href="%s">%s</a><table id="tl"></table>\n" % (
                snapshot.desc or 'Untitled',
                pp_timestamp(snapshot.timestamp)
            ))

            data = {}
            data['sys']      = pp(snapshot.system_total.vsz)
            data['tracked']  = pp(snapshot.tracked_total)
            data['asizeof']  = pp(snapshot.asizeof_total)
            data['overhead'] = pp(getattr(snapshot, 'overhead', 0))

            fobj.write(self.snapshot_summary % data)

            if snapshot.tracked_total:
                fobj.write(self.snapshot_cls_header)
                for classname in classlist:
                    data = snapshot.classes[classname].copy()
                    data['cls'] = '' % (self.relative_path(self.links[classname]), classname)
                    data['sum'] = pp(data['sum'])</td></tr></tbody></table>
github pympler / pympler / pympler / classtracker_stats.py View on Github external
if merged.refs:
                    self._print_refs(fobj, merged.refs, merged.size)
                else:
                    fobj.write('<p>No per-referent sizes recorded.</p>\n')

        fobj.write("<h2>Instances</h2>\n")
        for tobj in self.index[classname]:
            fobj.write('\n')
            fobj.write('' +
                       '\n' %
                       (tobj.name, tobj.id))
            if tobj.repr:
                fobj.write("" +
                           "\n" % tobj.repr)
            fobj.write("\n" %
                       (pp_timestamp(tobj.birth), pp_timestamp(tobj.death)))
            if tobj.trace:
                trace = "<pre>%s</pre><table width="100%" id="tl"><tbody><tr><td width="140px" id="hl">Instance</td><td id="hl">%s at 0x%08x</td></tr><tr><td>Representation</td><td>%s&nbsp;</td></tr><tr><td>Lifetime</td><td>%s - %s</td></tr><tr><td>Instantiation</td><td>%s</td></tr><tr><td>%s</td><td>%s</td></tr><tr><td>%s" % pp(size.size))
                    self._print_refs(fobj, size.refs, size.size)
                    fobj.write("</td></tr></tbody></table>" % (_format_trace(tobj.trace))
                fobj.write("\n" %
                           trace)
            for (timestamp, size) in tobj.snapshots:
                fobj.write("" % pp_timestamp(timestamp))
                if not size.refs:
                    fobj.write("\n" % pp(size.size))
                else:
                    fobj.write("\n")
            fobj.write("\n")

        fobj.write(self.footer)
        fobj.close()