-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OTS Statistics by kondra for TFS 1.6+ #4874
base: master
Are you sure you want to change the base?
Conversation
There are plenty of profiling tools already available. Even if someone wanted both instrumentation and sampling, there are still plenty of FOSS softwares out there that have whole teams of people who study this field of programming working on them. I think adding this to TFS would be a mistake, it's not needed, and for many like myself, not wanted. If I wanted to profile a TFS server, I certainly wouldn't use this code, I would get a professional grade profiler to do the job. Adding this system is adding un-needed, un-necessary, and un-asked for bloat to the code base, even with the #ifdef's, the core part of the code is added (stats.cpp/stats.h) whether or not it's enabled. Even if this system does an "ok" job, there are still plenty of FOSS profilers and paid profilers out there that would undoubtedly do a much better job, and still allows users the freedom to decide if they want to profile by sampling, or profile by instrumentation. It's just my opinion on the matter. |
This will be difference between having something or having nothing at all. I cannot even imagine devs downloading or paying for 3rd party profilers (obviously first a person would have to learn how to use and attach them to the engine (like its gonna happen xd))... all while there is ready&&free commmit that can do it for them. Simple, free, and all work already done by Gesior/Kondrah. 100% needs to be merged. |
I think it's a useful piece of code, it allows developer to catch weak points at the development stage. I agree with @Tofame about 3rd party profilers. |
Well, if the user doesn't have the ability or time to learn how to setup a profiler, then what are they actually gaining from even using one in the first place? I mean seriously, the people who can't figure out how to attach a profiler to a process, aren't going to know what to do with the data they are getting! Besides they don't need to download or pay, both Windows and Linux come stock with profilers. Visual studio has profiler built into it , and linux has various tools at its disposal as stock (depends on which ones for which distro). Both windows and linux users can use Jetbrains Rider for free, which also has a profiler. At any rate, I obviously highly disagree with the thought that this needs merged. This "limited" version isn't even worth its overhead. While I will agree it's beneficial to have detailed data about used resources, I think this "limited" instrumentation is just a bloat that would be in the way for a real instrumentation job. |
I tuned a bit first post stats to some values you may get on real OTS with bugged Lua script:
Do you need to know how to setup profiler to read which Lua script is a problem? If someone still doesn't get it, there is a tutorial: https://otland.net/threads/how-to-read-ots-statistics-logs.283722/ |
Yes, because the kondra "stats" system is a profiler. I prefer to just simply push the play/run button in my favorite IDE (both Rider and VS come with this feature built in) and launch my server through the IDE rather than add code to my server, and still get the relevant information I need via "sampling" instead of "instrumentation"... both will indicate the high usage of CPU from the process "onThink", and so ultimately both will get the job done, but with my way, I don't have a choice forced upon me. |
Off-topic related to OTS stats-profiler (source of this discussion): (of course only if you have time.) That could also be useful to this repo and the entire community. |
please, use his repo to talk about his project... open issue or something |
I have to agree with @ArturKnopik this is not the place for that discussion, just reach out to me on discord or otland if you need to talk with me. When I said "my server" I was speaking in a general context of an end user for TFS. As a user of TFS, I would rather have my server ran through my choice of profiler, than for the devs to just add a "limited" instrumentation job. |
The amount of shit, unoptimized code will only increase, because of GPT overuse (abuse). OTland resources tab is full of GPT generated scripts that are terrible. A step has to be taken, a code that simply generates logs for you without doing much work is very good. You can then do whatever, analyse by yourself or even send those logs.txt to someone knowledgable, pay.him/her and he/she will fix parts of code that will be needed without a need to send that person full sources/exe to run and profile. You forget about users of TFS/Canary, that are not developers (majority). A lot of amateurs that dont know what they are doing, if explained by a bit in documentation will learn to make use of it and improve their OTs. |
It's well known 'OTS stats' system with LIMITED FUNCTIONALITY FOR TFS 1.6+:
It does not track C++ functions executed by dispatcher as it's not possible on 1.6+ ( #4306 (comment) ).
To track usage by C++ functions, you have to add
AutoStat
to each function you want to track. More about it at end of this PR.It tracks all Lua function calls and SQL queries.
It generates files
lua.log
andsql.log
instats/
that looks like:Report interval is configurable in
config.lua
.It also reports slow/very slow function calls in files
lua_slow.log
andsql_slow.log
. Ex.startup.lua
onStartup event execution time is higher than 10 ms, it's reported as slow inlua_slow.log
:SQL took over 10 ms, it's reported as slow:
Slow/very slow time is configurable in
config.lua
There are also
special.log
,special_slow.log
andspecial_very_slow.log
, which report your custom statistics. Ex. to report decay time of items, ingame.cpp
under:add:
String
internalDecayItem
will be used for total CPU usage report. Second parameter (item ID) will be reported inslow
andvery_slow
logs. In this case, it would say which item ID decayed over 10 ms (single item decay time, not all items with this item ID).Most of OTSes pass player name as second parameter. It let them track which player generated 'slow' actions - lagged OTS.