Example #1
0
    def onSyncDone(sync_result, sl, t0, plop_collector, theseus):
        # TODO should write this to a result file
        print "GOT SYNC RESULT: ", sync_result
        t1 = datetime.now()
        if sl:
            sl.stop()
        if plop_collector:
            from plop.collector import PlopFormatter
            formatter = PlopFormatter()
            plop_collector.stop()
            if not os.path.isdir('profiles'):
                os.mkdir('profiles')
            with open('profiles/plop-sync-%s' % GITVER, 'w') as f:
                f.write(formatter.format(plop_collector))
        if theseus:
            with open('callgrind.theseus', 'wb') as outfile:
                theseus.write_data(outfile)
            theseus.uninstall()

        delta = (t1 - t0).total_seconds()
        # TODO should write this to a result file
        print "[+] Sync took %s seconds." % delta
        reactor.stop()

        if args.do_plot:
            from plot import plot
            plot(args.logfile)
Example #2
0
    def finish(self, *args, **kw):
        super().finish(*args, **kw)

        if self.get_argument("profile", None) and os.environ.get("ALLOW_PROFILING"):
            self.collector.stop()
            formatter = PlopFormatter(max_stacks=9001)
            if self.collector.samples_taken:
                formatter.store(self.collector, "{0}_{1}.profile".format(self.__class__.__name__, time.time()))
Example #3
0
 def finish_profile(self):
     self.collector.stop()
     formatter = PlopFormatter()
     self.finish(formatter.format(self.collector))