Im not always there when you post a problem...
Im just ALWAYS THERE !
I'd suggest to go with the loop option.
If you only calculate the FPS once, and it "happens" to be
either a "quiet" ro "busy" frame, it will give you a skewed value.
Anyhow, here is an untested bastardisation of the smoothed FPS calculator used by the 'default.c' debug-panel.
fps = 0.9 * fps + 0.1 / time_frame;
BTW, it gets updated once a frame, so put it in a while-loop with a wait(1) and it should calculate correctly.