alliedmodders / amxmodx

AMX Mod X - Half-Life 1 Scripting and Administration
http://www.amxmodx.org/
489 stars 197 forks source link

[NEW FEATURE] Performance monitor for help in detect bad performance plugins. #1017

Closed UnrealKaraulov closed 2 years ago

UnrealKaraulov commented 2 years ago

https://github.com/UnrealKaraulov/amxmodx/actions/runs/1524555146

Possible to fully integrate this feature from https://github.com/UnrealKaraulov/amxmodx ? (and enabled by cvar for example)

UnrealKaraulov commented 2 years ago

Someone can integrate this feature to AmxModX ?

ShootingKing-AM commented 2 years ago

Give more detailed explanation maybe ? Like what is "performance" how are you measuring it ? What's the benchmark for "bad plugins" ? And what is "bad" performance ?

UnrealKaraulov commented 2 years ago

Give more detailed explanation maybe ? Like what is "performance" how are you measuring it ? What's the benchmark for "bad plugins" ? And what is "bad" performance ?

@ShootingKing-AM This for print plugin and function names to log file if executed function executed with big lag like do "sleep" server for bigger than 1ms(decrease FPS)

UnrealKaraulov commented 2 years ago

It can help in search bad functions or plugins, example output from my pull request:

L 12/01/2021 - 10:03:28: [admincmd.amxx] performance issue 2. Function plugin_init executed more than 3 ms. L 12/01/2021 - 10:03:28: [cmdmenu.amxx] performance issue 2. Function plugin_init executed more than 10 ms. L 12/01/2021 - 10:03:28: [plmenu.amxx] performance issue 2. Function plugin_init executed more than 2 ms. L 12/01/2021 - 10:03:28: [mapsmenu.amxx] performance issue 2. Function plugin_init executed more than 3 ms. L 12/01/2021 - 10:03:28: [pluginmenu.amxx] performance issue 2. Function plugin_init executed more than 2 ms. L 12/01/2021 - 10:03:28: [adminchat.amxx] performance issue 2. Function plugin_init executed more than 2 ms.

UnrealKaraulov commented 2 years ago

@ShootingKing-AM this just example ( plugin_init can has many code with input lag like read / write files or sql_execute and this is normal for init functions)

ShootingKing-AM commented 2 years ago

Nice idea actually. We can have this pf counter while plugin is running in debug mode.

We can wait for more community comments. Why don't you ping bailopan for his comment regarding this ? :P

Am also curious about what the server outputs(with your pr) for zombie plague. Imo it's the fatest plug-in.

UnrealKaraulov commented 2 years ago

@ShootingKing-AM I don't know the rules for writing code for AMXMODX because I never wrote Pull Requests for AMXMODX.

Should this feature be activated by cvar in amxx.cfg? or for any plugin in 'debug' mode ?

I tried to add it in https://github.com/alliedmodders/amxmodx/pull/1016 but can't test because my test server need old glibc (2.17) , but I test it with local Windows server, and this is works wihout troubles.

ShootingKing-AM commented 2 years ago

I don't think there are any official rules for writing code for amxmodx. Only there are some guidelines for PRs which you can find here (https://github.com/alliedmodders/amxmodx/blob/master/.github/CONTRIBUTING.md#pull-requests)

Most important thumb-rule for PRs, The more descriptive you would be in explaining the changes the faster would be your review. Personally, no matter how god-level code you wrote i didn't even check your pr's changes and then get to the intention of "why" you are writing the code. Bail was kind enough to review and make some comments though.

More thumb-rules on this site on how to make good PRs :) - https://developers.google.com/blockly/guides/modify/contribute/write_a_good_pr

My suggestion was to enable pf monitoring only on debug because normal users won't even understand what's "plugin_init" is. Anyways that was my suggestion, you may or may not agree with this since you are the Author. Do what you think fits the best and then let the maintainers comment.

You need to update your linux os or update libraries i guess for the old glibc issue or have a local vm of some linux for testing.

UnrealKaraulov commented 2 years ago

I recreated my pull request : https://github.com/alliedmodders/amxmodx/pull/1019

ShootingKing-AM commented 2 years ago

I recreated my pull request : #1019

This is much more clean and descriptive than the previous one :)