A problem with getting listeners for the current frame of an animation

I created an animation and wanted to add some operations to a certain frame of the animation. I used the following PG method and found that the printed currentframe was missing some frames because the frame per second I set for the animation I created was too large.

THIS IS MY PG:

Is there any perfect way to accurately obtain each current frame of the animation?

I don’t know the cost, but this seems certain.