# How often is this called?

Hello there, it’s been a while already but believe it or not I came back to this video to understand more about profiling and I’m veeery confused. According to this video at the minute 7:40 you calculate how often `Cycle_Index` is called, you take 77fps * 0.003 = 0.231 and you explain that this is called once every 0.23 of a second, hence 5 times a second.

Now let’s keep this rule and drop to 15fps, take a function, let’s call it A() that has 90% of calls and calculate how often is called, this would be 15fps * 0.9 = 13.5

Does this mean that A() is called 13,5 times a second?

Now take function B() that has 0.3% of calls and keep the same 15 fps, so 15fps * 0.003 = 0.045, meaning that this function B() is being called once every 0.045 of a second, hence about 25 times a second.

How is it possible that B() is called more often than A() if B() has only 0.3% of frames with a call to this stat​ while A() has 90%?

I’m pretty sure I’m missing something, could someone here help me understand?

1 Like

My response as paraphrased from the Discord channel:

I think this method of interpreting the profiler is wrong. I just can’t get the dimensional analysis for `frames / sec * pct_of_total_calls = calls / sec` to work. I would appreciate clarification as well if anyone has it.

You may or may not care about this anymore, but there was a math error in the video that was addressed after the fact in the Q&A. Ben said that is was called once every 0.23 seconds, when it should be the reciprocal: “0.23 times a second” or “once every 4.35 (1 / 0.23) seconds”.

It is a very easy mistake to make, as it seems you made the same one in your question, and it took me awhile to figure out why the numbers made sense to my ears, but not my brain. Saying, “X() is called Y times a second,” and, “X() is called once every Y seconds,” are reciprocal statements, but used subtly as equivalents in your question and presumably in a momentary lapse in Ben’s brain (not saying either of you aren’t smart; I think Ben is brilliant and the fact that you made it this far in the course and have probably finished by now says the same of you!). The proper statements for your question would be as follows:

A() is called 13.5 times a second, or once every 0.074 seconds, and B() is called .045 times a second, or once every 22.222 seconds.

The subtle error was interpreting the 0.045 as “once every 0.045 of a second,” instead of “0.045 times a second.”

I hope that helped! I was came to the discussions because I made the same mistake with my profiling and was wondering what was going on haha