# Incorrect frame rate logs on Pavlovia

**URL:** <https://discourse.psychopy.org/t/incorrect-frame-rate-logs-on-pavlovia/15255>\
**Category:** Online experiments\
**Tags:** timing, pavlovia\
**Created:** [July 23, 2020, 4:40pm UTC](https://discourse.psychopy.org/t/incorrect-frame-rate-logs-on-pavlovia/15255 "2020-07-23T16:40:49Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![ade\_mh](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@ade\_mh](https://discourse.psychopy.org/u/ade_mh)\
**Post date:** [August 7, 2020, 11:09am UTC](https://discourse.psychopy.org/t/incorrect-frame-rate-logs-on-pavlovia/15255/8 "2020-08-07T11:09:33Z")

</div>

This works perfectly, thank you very much for the help!  
I tweaked it a little bit to change how the values are logged, I’ll post below what I ended up adding to my Instructions routine (which is mostly your code), in case anyone else needs it - the difference here I guess is that the interval for averaging is variable e.g. for as long as the routine is viewed:

Begin Experiment:

```auto
window.refreshCount = 0;
window.refreshStart = null;
window.refreshFinish = null;

```

Each Frame:

```auto
    if (window.refreshStart === null) {
        window.refreshStart = window.performance.now();
     } else {
        window.refreshFinish = window.performance.now();
        window.refreshCount++;    
     }

    console.log(window.refreshCount);
    console.log(window.performance.now());

```

End Routine:

```auto
let duration = window.refreshFinish - window.refreshStart;
expInfo['realFrameRate'] = (duration / window.refreshCount);

```

---

_[View the full topic](https://discourse.psychopy.org/t/incorrect-frame-rate-logs-on-pavlovia/15255)._
