Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Add pre/postEventFunction to addDebugHook #126
This PR adds, see title, two new debug hook types called preEventFunction and postEventFunction. You can now have greater control over event handling throughout your entire server if you want to debug your own implemented functionality in this region.
string preEventFunction( resource eventResource, string eventName, element eventSource, element eventClient, string eventFilename, int eventLineNumber, resource functionResource, string functionFilename, int functionLineNumber, ...eventArgs ) postEventFunction( resource eventResource, string eventName, element eventSource, element eventClient, string eventFilename, int eventLineNumber, resource functionResource, string functionFilename, int functionLineNumber, ...eventArgs )
Nice stuff. I've suggested a thing or two, but if you've given this thorough testing, feel free to adjust the labels and give this a merge
I feel that giving scripters and server owners profiling tools like this can't hurt, neither be a bloat, but indeed it can be something useful to gather information about how are concrete parts of a resource behaving.
Talking about the particular use-case that @Necktrox mentioned, I think that onClientRender can be a major performance bottleneck for the server when not so well designed algorithms are in place or just when a need to do extremely frequently operations arises (depending on the gamemode, it may be necessary to tie some logic at the execution speed of the game. And it could happen that one big resource does those operations). One could argue that in well designed scripts that shouldn't be a performance hog, and it would be right. But at least this PR would provide people who design that performance hogs tools to prove that they are doing something wrong, right?
Besides, CPU usage can be a concern for server owners (albeit unlikely sor a MTA server alone), so anything that could give them more factual data about how are the CPU cycles being used seems welcome.