[英]Count how many times a function is called in a time
I need a way to check how many times a function is called in a second.我需要一种方法来检查 function 在一秒钟内被调用了多少次。 I need to see in 1 second how many times it gets called.
我需要在 1 秒内查看它被调用了多少次。 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
我看到了关于调用多少次的技巧。我需要的是在 1 秒或 5 秒内调用多少次
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.我有一个在线游戏,作弊者破坏了速度黑客...... function 被称为
CCharacter::Attack
,我需要根据他的角色状态计算普通玩家每秒可以调用多少次 function..。 And the count how many times per second a hacker call ::Attack
并计算黑客每秒调用多少次
::Attack
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
如果您的 func 的 N 次运行需要 K 秒,您可以通过除以
result=N/K
或 5 秒result5 = 5*N/K
来计算“在 1 秒内调用 func 的次数”
You would need two things:你需要两件事:
Good luck implementing this.祝你好运实现这一点。 Please post the result, this might be very interesting for other people, too!
请发布结果,这对其他人来说可能也很有趣!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.