Calculate frame rate

Hi! Do anyone know if it is possible to calculate the frame rate during play mode? Something like… make Unity calculate it using script. If it is possible, how could i do it?

I want to calculate the average frame rate of player’s while they are playing my game. Actually, i wanted to make this via script. This would let me not only show to the player the performance that he is having, but also in many other things, such as based actions.

For an example:

The player has 30+ fps, change the settings to medium. The player has 60+ fps, change settings to high. The player has 47 fps, show something to let him know, etc…

http://wiki.unity3d.com/index.php?title=FramesPerSecond

You can use this free extension bitif you want:

It shows a graphic with FPS history, minimum, maximum and average values.

And it has a memory watcher too.