[Python] is it possible to Python code to measure FPS in specific Games/Window [closed]

Discussão em 'Python' iniciado por Stack, Dezembro 17, 2024.

  1. Stack

    Stack Membro Participativo

    I need to monitor FPS of a specific game / window and I have tried this, it is constantly showing FPS around 60 FPS but it is not actually true...

    import time
    import collections

    class FPS:
    def __init__(self,avarageof=50):
    self.frametimestamps = collections.deque(maxlen=avarageof)
    def __call__(self):
    self.frametimestamps.append(time.time())
    if(len(self.frametimestamps) > 1):
    return len(self.frametimestamps)/(self.frametimestamps[-1]-self.frametimestamps[0])
    else:
    return 0.0
    fps = FPS()

    while True:
    time.sleep(0.1)
    print(round(fps()))

    Continue reading...

Compartilhe esta Página