FrameRate Graph , <solved>
Monkey Forums/Monkey Programming/FrameRate Graph , <solved>
| ||
Just noticed a screen shot some one posted on twitter today, screen shot of their game I guess but what really caught my attention was the little fps graph at the bottom, looked like a neat little fps/render/cpu type bar graph that I assume scrolled as the app ran. I was wondering if anyone had code for this, done anything like this with monkey. |
| ||
I have a little FPS counter that I can turn on or off in my basic framework app, but it just prints a moving average of the current frame rate. A graph would be easy enough, though, you just save up to 60 values or whatever, and start dropping the earliest values once you have enough. You can use a list, or a cyclic buffer if you're worried about memory allocation. |
| ||
Yeah I just threw this together.see bellow |
| ||
It actually looks kinda cool, at a glance I can see the previous few seconds worth of fps data and can see where things are slowing down, wondering what else I could add to it. |
| ||
I'm using this one from Raph: http://monkeycoder.co.nz/Community/posts.php?topic=5443 |
| ||
Ah cool, I knew some one else would have done it at some point. Think I might nick a little idea here or there from his code. :) thanks for linking that. |
| ||
nvm :/ |
| ||
I am glad someone is finding my code useful :) |
| ||
yup helped me out.. I was wondering why you used lists rather than an array, was it for the easy use of first and last or did you have something else in mind. |
| ||
Yes, it was for easy first and last. I thought about an array... For these tiny purposes, I don't know that it makes much of a difference, and I was in a hurry, so I favored "least likely to create a bug." I am more likely to screw up my math in creating a manual circular buffer than I am to mess up two API calls. ;) Oh, and I saw most of the value being in the UI of it anyway, not the backend. |
| ||
I was thinking about pulling in a few little bits of art to make it really shine and get rid of those calls to set color and draw rect, but I am not sure how bad that might be on impact for frame rates when its running with a game that's also throwing tons of stuff at the screen, would look nice tho. |