Is there a way to get the framerate?

I want to know how fast my sketch is running (to do some optimization of the code).

I know you can set the frame rate, but if you don't set it and you run a (computational heavy) sketch, the frame rate goes down. Is there a way to know the frame rate?

Another way I thought of checking the speed of my simulation is to add a value every time draw() is used and divide this value with second(). This gives the number of draws/second but it fluctuates to much.

Is there another/better way to check the "speed" of a sketch?

Thanks

Tagged:

Answers

  • Answer ✓

    println(frameRate);

    use P3D in size();

  • edited April 2014 Answer ✓

    As well as framerate() to set the frame rate, there's a global variable framerate which should do what you want. See the reference here.

    (edit: too slow)

  • edited April 2014

    frameRate() controlles the framerate (means it can slow down it) but it cannot push/force the program to run at high frameRate. Once I had faced the same problem and disscussed here

  • OK thanks,

    Should have tried println(frameRate); before asking this question :)

  • edited April 2014

    @blyk: Yes, that's important to bear in mind. You shouldn't have to use P3D in size(), though — it should work with any renderer.

Sign In or Register to comment.