ULX

Author Topic: Hook diagnostics  (Read 4987 times)

0 Members and 1 Guest are viewing this topic.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Hook diagnostics
« on: April 06, 2015, 06:40:55 PM »
I was reading through some earlier threads around performance of the users.txt file with high counts of players in groups other than "users"  (I too use autopromote in my sandbox server in conjunction with URS to limit access to sweps and ents to specific ranks earned based on time on the server).  While I don't believe I have lag problems around accessing users.txt, I do feel a bit of lag whenever someone spawns in  (which I believe is related more to Patch Protect and its reshuffling of touch rights as people spawn in).

The keyword is "believe".  I have no hard data - just subjective experience.  Enter potentially ridiculous idea #324 into my wee little brain.  If I wanted to try and track true diagnostic timing information around GMod hooks and the processes running within them, would something like this make sense...?

1) Create a high priority hook (-20) for all GMod hooks I'm interested in tracking (ie, PlayerInitialSpawn).  The only logic within each is to record the current high precision time.
2) Create a low priority hook (20) for the same GMod hooks, the logic of which calculates a differential between the current precision time and the previous start time for that particular hook.
3) The delta here should represent the total processing time across all of the various active hooks...  roughly, anyway.

In theory this should start to give me insight into high-intensive processing areas, and I can begin to narrow my investigation/refactoring to the implementations of the hook(s) that show the highest consumption.

Make sense, or am I missing something that might skew the results?  I realize I'm not going to get actual cpu time from any of this  -- but I think it'll give me relative processing requirements and might cast a bright light on hooks that are causing noticeable lag.

Thanks.
« Last Edit: April 06, 2015, 06:47:49 PM by Buzzkill-THABB »

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Hook diagnostics
« Reply #1 on: April 07, 2015, 12:19:29 AM »
Whenever someone spawns in, UCL accesses the users.txt file to update it with their name. If you have a large file (hundreds or thousands of users) you will notice small spikes while gmod accesses this file.

Offline Buzzkill

  • Respected Community Member
  • Full Member
  • *****
  • Posts: 176
  • Karma: 59
    • The Hundred Acre Bloodbath
Re: Hook diagnostics
« Reply #2 on: April 07, 2015, 05:13:18 AM »
Thanks.  My users file is only currently about 40K (file size, not name count). Probably some lag in there that I could tease out with a MySql implementation, but I was curious more about the approach to hook diagnostics and timing data in general.  I'm always interested in knowing if I've introduced lag with a new addon, change in config or general growth.

Thanks. 
« Last Edit: April 07, 2015, 07:11:00 AM by Buzzkill-THABB »

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given