Esempio n. 1
0
 def wrapped(self, *args, **kwargs):
     FlameProfiler.updateProfileConfig()
     if FlameProfiler.isRecordingProfile():
         with FlameProfiler.profileCall("[SIG] " + self.getName()):
             func(self, *args, **kwargs)
     else:
         func(self, *args, **kwargs)
Esempio n. 2
0
 def wrapped(self, *args, **kwargs):
     FlameProfiler.updateProfileConfig()
     if FlameProfiler.isRecordingProfile():
         with FlameProfiler.profileCall("[SIG] " + self.getName()):
             func(self, *args, **kwargs)
     else:
         func(self, *args, **kwargs)
Esempio n. 3
0
    def __performEmit(self, *args, **kwargs) -> None:
        # Quickly make some private references to the collections we need to process.
        # Although the these fields are always safe to use read and use with regards to threading,
        # we want to operate on a consistent snapshot of the whole set of fields.

        # The acquire_timeout is here for debugging / profiling purposes, which might help us figure out why certain
        # people experience slowdowns. At a certain point this can be removed.
        copy_successful = False
        while not copy_successful:
            with acquire_timeout(self.__lock, 0.5) as acquired:
                if acquired:
                    functions = self.__functions
                    methods = self.__methods
                    signals = self.__signals
                    copy_successful = True
                else:
                    Logger.log(
                        "w",
                        "Getting lock for signal [%s] took more than 0.5 seconds, this should not happen!",
                        self)

        if not FlameProfiler.isRecordingProfile():
            # Call handler functions
            for func in functions:
                func(*args, **kwargs)

            # Call handler methods
            for dest, func in methods:
                func(dest, *args, **kwargs)

            # Emit connected signals
            for signal in signals:
                signal.emit(*args, **kwargs)
        else:
            # Call handler functions
            for func in functions:
                with FlameProfiler.profileCall(func.__qualname__):
                    func(*args, **kwargs)

            # Call handler methods
            for dest, func in methods:
                with FlameProfiler.profileCall(func.__qualname__):
                    func(dest, *args, **kwargs)

            # Emit connected signals
            for signal in signals:
                with FlameProfiler.profileCall("[SIG]" + signal.getName()):
                    signal.emit(*args, **kwargs)
Esempio n. 4
0
    def __performEmit(self, *args, **kwargs):
        # Quickly make some private references to the collections we need to process.
        # Although the these fields are always safe to use read and use with regards to threading,
        # we want to operate on a consistent snapshot of the whole set of fields.
        with self.__lock:
            functions = self.__functions
            methods = self.__methods
            signals = self.__signals

        if not FlameProfiler.isRecordingProfile():
            # Call handler functions
            for func in functions:
                func(*args, **kwargs)

            # Call handler methods
            for dest, func in methods:
                func(dest, *args, **kwargs)

            # Emit connected signals
            for signal in signals:
                signal.emit(*args, **kwargs)
        else:
            # Call handler functions
            for func in functions:
                with FlameProfiler.profileCall(func.__qualname__):
                    func(*args, **kwargs)

            # Call handler methods
            for dest, func in methods:
                with FlameProfiler.profileCall(func.__qualname__):
                    func(dest, *args, **kwargs)

            # Emit connected signals
            for signal in signals:
                with FlameProfiler.profileCall("[SIG]" + signal.getName()):
                    signal.emit(*args, **kwargs)
Esempio n. 5
0
    def __performEmit(self, *args, **kwargs):
        # Quickly make some private references to the collections we need to process.
        # Although the these fields are always safe to use read and use with regards to threading,
        # we want to operate on a consistent snapshot of the whole set of fields.
        with self.__lock:
            functions = self.__functions
            methods = self.__methods
            signals = self.__signals

        if not FlameProfiler.isRecordingProfile():
            # Call handler functions
            for func in functions:
                func(*args, **kwargs)

            # Call handler methods
            for dest, func in methods:
                func(dest, *args, **kwargs)

            # Emit connected signals
            for signal in signals:
                signal.emit(*args, **kwargs)
        else:
            # Call handler functions
            for func in functions:
                with FlameProfiler.profileCall(func.__qualname__):
                    func(*args, **kwargs)

            # Call handler methods
            for dest, func in methods:
                with FlameProfiler.profileCall(func.__qualname__):
                    func(dest, *args, **kwargs)

            # Emit connected signals
            for signal in signals:
                with FlameProfiler.profileCall("[SIG]" + signal.getName()):
                    signal.emit(*args, **kwargs)