Up to Main Index Up to Journal for January, 2022 JOURNAL FOR SUNDAY 16TH JANUARY, 2022 ______________________________________________________________________________ SUBJECT: #DEBUG command added and #GOTO/#TELEPORT commands fixed DATE: Sun 16 Jan 20:42:42 GMT 2022 For the past week I’ve been kept busy with work, which is good. It does mean I’ve had less time than usual to work on WolfMUD :( However, I’ve implemented the missing #DEBUG command. The #DEBUG command has several sub-commands: MEMPROF, CPUPROF and PANIC. The PANIC command is the simplest, it deliberately causes a runtime panic in the command parsing. This is used for testing the client panic handler. The MEMPROF and CPUPROF commands are used to take memory and CPU profiles of the server while it is running. Both profiles can be started with the ON or START options and ended with the OFF, STOP or END options. For example: >#DEBUG MEMPROF ON Memory profile started. : time passes... : >#DEBUG MEMPROF OFF Memory profile stopped. > The profile will be written as either ‘memprof’ or ‘cpuprof’ in the server’s current working directory. The profiles can then be examined with the normal pprof tools. For example: >go tool pprof --alloc_objects memprof File: server Type: alloc_objects Time: Jan 16, 2022 at 7:58pm (GMT) Entering interactive mode (type "help" for commands, "o" for options) (pprof) top Showing nodes accounting for 1014, 83.66% of 1212 total Dropped 50 nodes (cum <= 6) Showing top 10 nodes out of 52 flat flat% sum% cum cum% 275 22.69% 22.69% 275 22.69% strings.(*Builder).WriteString 166 13.70% 36.39% 494 40.76% .../WolfMUD.git/core.(*state).Msg 117 9.65% 46.04% 117 9.65% strings.Fields 116 9.57% 55.61% 116 9.57% .../WolfMUD.git/core.NewState 60 4.95% 60.56% 60 4.95% .../WolfMUD.git/core.radius 58 4.79% 65.35% 119 9.82% .../WolfMUD.git/core.(*Thing).schedule 58 4.79% 70.13% 755 62.29% .../WolfMUD.git/core.(*state).subparse 58 4.79% 74.92% 61 5.03% time.AfterFunc 53 4.37% 79.29% 53 4.37% regexp.(*bitState).reset 53 4.37% 83.66% 53 4.37% strings.(*Builder).Write (pprof) Being able to toggle memory and CPU profiling on and off when needed is very useful when debugging. I usually get the server started, everything loaded and a specific test condition setup before turning memory profiling on, carry out the tests and then turn off the profiling. This enables me to capture data for the specific period I am interested in. This is in addition to tests and benchmarking as I can see what is happening live and inspect items with the #DUMP command. The #DEBUG command is available when the Debug.AllowDebug server configuration option is set to true. If Debug.AllowDebug is set to false, the default, then the player is informed that the #DEBUG command is unavailable. I’ve also fixed an issue with the #GOTO/#TELEPORT commands which would cause a player to appear to be in multiple locations at the same time. Changes adding the #DEBUG command and fixes for the #GOTO/#TELEPORT commands are now on the public dev branch. At some point I plan on adding a means for a player to be flagged as an Admin. Once implemented the debugging and admin commands will only be available to users flagged as admins and a lot of the configuration options will no longer be required and will be removed. This is planned for the big clean-up after v0.0.19 is released. In the meantime I’ve started implementing player health, dynamic prompts and the HIT command — for testing health regeneration on players and mobiles. Once completed I think it will be time for either a snapshot or full release — I believe health and the HIT command are the last features from v0.0.18 that are missing in the rewrite, but I’d need to double check… -- Diddymus Up to Main Index Up to Journal for January, 2022