Exemple #1
0
    def _iprof_exec(options, user_args):
        """
        Called from a command line to instance based profile data in a web page.
        """
        if options.file[0].endswith('.py'):
            if len(options.file) > 1:
                print("iprofview can only process a single python file.", file=sys.stderr)
                sys.exit(-1)

            _iprof_py_file(options, user_args)
            if MPI:
                options.file = ['iprof.%d' % i for i in range(MPI.COMM_WORLD.size)]
            else:
                options.file = ['iprof.0']

        if not options.noshow and (not MPI or MPI.COMM_WORLD.rank == 0):
            app = _Application(options)
            app.listen(options.port)

            print("starting server on port %d" % options.port)

            serve_thread = _startThread(tornado.ioloop.IOLoop.current().start)
            launch_thread = _startThread(lambda: _launch_browser(options.port))

            while serve_thread.is_alive():
                serve_thread.join(timeout=1)
Exemple #2
0
def _iprof_exec(options):
    """
    Called from a command line to instance based profile data in a web page.
    """
    if options.file[0].endswith('.py'):
        if len(options.file) > 1:
            print("iprofview can only process a single python file.", file=sys.stderr)
            sys.exit(-1)
        _iprof_py_file(options)
        options.file = ['iprof.0']

    if not options.noshow:
        app = _Application(options)
        app.listen(options.port)

        print("starting server on port %d" % options.port)

        serve_thread  = _startThread(tornado.ioloop.IOLoop.current().start)
        launch_thread = _startThread(lambda: _launch_browser(options.port))

        while serve_thread.isAlive():
            serve_thread.join(timeout=1)