How to use the yappi.is_running function in yappi

To help you get started, we’ve selected a few yappi 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 ilastik / ilastik / ilastik / shell / gui / ilastikShell.py View on Github external
def _exportSortedStats(sortby):
            assert not yappi.is_running()

            filename = 'ilastik_profile_sortedby_{}.txt'.format(sortby)
            recentPath = PreferencesManager().get('shell', 'recent sorted profile stats')
            if recentPath is None:
                defaultPath = os.path.join(os.path.expanduser('~'), filename)
            else:
                defaultPath = os.path.join(os.path.split(recentPath)[0], filename)
            stats_path, _filter = QFileDialog.getSaveFileName(
                self, "Export sorted stats text", defaultPath, "Text files (*.txt)",
                options=QFileDialog.Options(QFileDialog.DontUseNativeDialog))

            if stats_path:
                pstats_path = os.path.splitext(stats_path)[0] + '.pstats'
                PreferencesManager().set('shell', 'recent sorted profile stats', stats_path)

                # Export the yappi stats to builtin pstats format, 
github ilastik / ilastik / ilastik / shell / gui / ilastikShell.py View on Github external
def _exportSortedThreadStats(sortby):
            assert not yappi.is_running()

            filename = 'ilastik_threadstats_sortedby_{}.txt'.format(sortby)

            recentPath = PreferencesManager().get('shell', 'recent sorted profile stats')
            if recentPath is None:
                defaultPath = os.path.join(os.path.expanduser('~'), filename)
            else:
                defaultPath = os.path.join(os.path.split(recentPath)[0], filename)
            stats_path, _filter = QFileDialog.getSaveFileName(
                self, "Export sorted stats text", defaultPath, "Text files (*.txt)",
                options=QFileDialog.Options(QFileDialog.DontUseNativeDialog))

            if stats_path:
                PreferencesManager().set('shell', 'recent sorted profile stats', stats_path)

                # Export the yappi stats to builtin pstats format, 
github ilastik / ilastik / ilastik / shell / gui / ilastikShell.py View on Github external
def _exportSortedStats(sortby):
            assert not yappi.is_running()

            filename = "ilastik_profile_sortedby_{}.txt".format(sortby)
            recentPath = preferences.get("shell", "recent sorted profile stats")
            if recentPath is None:
                defaultPath = os.path.join(os.path.expanduser("~"), filename)
            else:
                defaultPath = os.path.join(os.path.split(recentPath)[0], filename)
            stats_path, _filter = QFileDialog.getSaveFileName(
                self,
                "Export sorted stats text",
                defaultPath,
                "Text files (*.txt)",
                options=QFileDialog.Options(QFileDialog.DontUseNativeDialog),
            )

            if stats_path:
github ilastik / ilastik / ilastik / shell / gui / ilastikShell.py View on Github external
def _updateMenuStatus():
            startAction.setEnabled(not yappi.is_running())
            stopAction.setEnabled(yappi.is_running())
            for action in sortedExportSubmenu.actions():
                action.setEnabled(not yappi.is_running() and not yappi.get_func_stats().empty())
            for action in sortedThreadExportSubmenu.actions():
                action.setEnabled(not yappi.is_running() and not yappi.get_func_stats().empty())
github saltstack / salt / salt / utils / debug.py View on Github external
def _handle_sigusr2(sig, stack):
    '''
    Signal handler for SIGUSR2, only available on Unix-like systems
    '''
    try:
        import yappi
    except ImportError:
        return
    if yappi.is_running():
        yappi.stop()
        filename = 'callgrind.salt-{0}-{1}'.format(int(time.time()), os.getpid())
        destfile = os.path.join(tempfile.gettempdir(), filename)
        yappi.get_func_stats().save(destfile, type='CALLGRIND')
        if sys.stderr.isatty():
            sys.stderr.write('Saved profiling data to: {0}\n'.format(destfile))
        yappi.clear_stats()
    else:
        if sys.stderr.isatty():
            sys.stderr.write('Profiling started\n')
        yappi.start()
github ilastik / ilastik / ilastik / shell / gui / ilastikShell.py View on Github external
def _updateMenuStatus():
            startAction.setEnabled(not yappi.is_running())
            stopAction.setEnabled(yappi.is_running())
            for action in sortedExportSubmenu.actions():
                action.setEnabled(not yappi.is_running() and not yappi.get_func_stats().empty())
            for action in sortedThreadExportSubmenu.actions():
                action.setEnabled(not yappi.is_running() and not yappi.get_func_stats().empty())
github alttch / pptop / pptop / plugins / threads.py View on Github external
def injection_load(**kwargs):
    import threading
    try:
        import yappi
        if not yappi.is_running():
            yappi.start()
    except:
        pass
github ilastik / ilastik / ilastik / shell / gui / ilastikShell.py View on Github external
def _updateMenuStatus():
            startAction.setEnabled(not yappi.is_running())
            stopAction.setEnabled(yappi.is_running())
            for action in sortedExportSubmenu.actions():
                action.setEnabled(not yappi.is_running() and not yappi.get_func_stats().empty())
            for action in sortedThreadExportSubmenu.actions():
                action.setEnabled(not yappi.is_running() and not yappi.get_func_stats().empty())