Yes - it's called "profiling" and there's loads of work in general programming on this. Here is a nice generic macro for you, note that you will need additional function (or just one called "DoProfile(funcname[], time);") to make it work, this will also not currently work with functions taking arrays or strings as parameters (it is possible to make it work, but it's a VERY complex macro to do so (in fact many macros)):
pawn Код:
pawn Код:
What you do in "DoProfile" is up to you (and note that you will get a LOT of "0"s because most of your functions (hopefully all of them) will run too fast to be detected). In fact, ignore that, the only real way to do this is to call functions many many times and average the call times, however that doesn't tell you if slow functions are called a lot, so really this can only be done with a plugin. In fact this would be a good extension to the crash detect plugin which already requires -d0 and recommends -r on the compiler to get function information and can get stack trace information. I smell a new useful plugin. |