Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Count how many times a function is called in a time

Tags:

c++

I need a way to check how many times a function is called in a second. I need to see in 1 second how many times it gets called. How I can do that? I saw tricks about how many times is called.. what I need is how many times is called in 1 second or 5 second

I have an online game, and cheaters did damage speed hacks... The function is called CCharacter::Attack, I need to count how many times per second a normal player can call this function.. based on his character status. And the count how many times per second a hacker call ::Attack

like image 643
Napi Avatar asked Dec 14 '25 21:12

Napi


1 Answers

If N runs of your func take K seconds, you can calculate "number of time func is called in 1 second" by dividing result=N/K or in 5 sec result5 = 5*N/K

like image 173
warchantua Avatar answered Dec 16 '25 14:12

warchantua



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!