Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Stats class to track a time window. #67

Open
tsherif opened this issue Apr 9, 2019 · 6 comments
Open

Allow Stats class to track a time window. #67

tsherif opened this issue Apr 9, 2019 · 6 comments
Assignees

Comments

@tsherif
Copy link
Contributor

tsherif commented Apr 9, 2019

Deck usage requires gathering measurements that only become visible after a certain number of measurements. The Stats object should support this usage. I think the simplest way to do this would that the Stats object should have a windowSize property. Calls to stat updates like incrementCount, addTime, etc. should only update private members _count and _time. count and time properties would only be updated when _count % windowSize === 0.

@Pessimistress this should support the usage you need for Deck without _onMetrics.

@Pessimistress
Copy link
Collaborator

Is the window size by count or by seconds? In the deck use case, we want the time window - I guess it's fine if we have >60fps and just extract HZ from the last 60 bumps, but if we have <10fps we definitely want to know if things improved during the last second.

@tsherif
Copy link
Contributor Author

tsherif commented Apr 9, 2019

I'd prefer to do it based on count, because that would be a consistent sampling. Is there a reason why it has to be the last 1s vs 60 frames, however long it took to get that many?

@Pessimistress
Copy link
Collaborator

My understanding is that the Stats class does not have the built in notion of "frame". The last 60 calls to incrementCount may happen at 1fps, 1fps, ... then increase to 10fps. What do I get when I call getHZ() in this case?

@tsherif
Copy link
Contributor Author

tsherif commented Apr 9, 2019

For FPS, it will give you the average over those frames. I think it makes more sense to base it on the count for two reasons. If based on time:

  • You'll be comparing between different sample sizes.
  • You'll be comparing between different times because the timing can't have resolution < 1 frame.

Could you provide some more detail about how you want to use these metrics? I might not be understanding something about what you need to do.

Another thought is that if you want more detail, the frame timers offer more information than the FPS.

@Pessimistress
Copy link
Collaborator

Ok you have a point. I think this will work fine since it is brand new API. As long as the behavior is clearly documented, we can always adapt if new use cases appear.

@tsherif
Copy link
Contributor Author

tsherif commented Apr 10, 2019

One final idea: would it be helpful to get the min and max over the window? We could do this pretty easily by tracking minTime and maxTime across the window for the time metrics and providing getMinHz and getMaxHz methods.

@tsherif tsherif assigned tsherif and unassigned 1chandu Apr 30, 2019
@ibgreen ibgreen changed the title Allow Stats class to track a window. Allow Stats class to track a time window. Aug 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants