How to use the pyinstrument.stat_profiler.NotMainThreadError function in pyinstrument

To help you get started, we’ve selected a few pyinstrument 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 joerick / pyinstrument / pyinstrument / stat_profiler.py View on Github external
def stop(self):
        signal.setitimer(signal.ITIMER_REAL, 0.0, 0.0)

        try:
            signal.signal(signal.SIGALRM, signal.SIG_IGN)
        except ValueError:
            raise NotMainThreadError()
github joerick / pyinstrument / pyinstrument / stat_profiler.py View on Github external
def __init__(self, message=''):
        super(NotMainThreadError, self).__init__(message or NotMainThreadError.__doc__)
github joerick / pyinstrument / pyinstrument / stat_profiler.py View on Github external
def start(self):
        try:
            signal.signal(signal.SIGALRM, self.signal)
        except ValueError:
            raise NotMainThreadError()

        signal.setitimer(signal.ITIMER_REAL, self.interval, 0.0)
        self.last_signal_time = timer()