frames per second on iphone

How would I get accurate frames per second on iphone. I tried a few scripts but not sure if they are working correctly since they don’t match the fps on the stats page in the editor when running in the editor.

Here’s a script that updates a textmesh called text3d.

var updateInterval = 0.5;
 
private var accum = 0.0; // FPS accumulated over the interval
private var frames = 0; // Frames drawn over the interval
private var timeleft : float; // Left time for current interval
 
function Start()
{
   
    timeleft = updateInterval;  
}
 
function Update()
{
    timeleft -= Time.deltaTime;
    accum += Time.timeScale/Time.deltaTime;
    ++frames;
 
    // Interval ended - update GUI text and start new interval
    if( timeleft <= 0.0 )
    {
        // display two fractional digits (f2 format)
        gameObject.GetComponent(TextMesh).text = "" + (accum/frames).ToString("f2");
        timeleft = updateInterval;
        accum = 0.0;
        frames = 0;
    }
}

That script is correct. The fps in the stats is how long it takes to draw the graphics, not the fps overall.