Logging memory stats?

Discussions about Servers
Post Reply
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Logging memory stats?

Post by Barbie »

Is there any way to get information about engines' memory usage into the log file? I tried

Code: Select all

Log(ConsoleCommand("MEMSTAT"));
but on my linux box that results in
ucc.init.log wrote:MEMSTAT command not available.
The reason for my question is servers segmentation fault on some maps at the moment of collecting garbage. There I'd like to have more details about memory consumption.
Spoiler
ucc.init.log wrote:HorseFly57 flew out of the world!
HorseFly22 flew out of the world!
HorseFly1 flew out of the world!
HorseFly39 flew out of the world!
HorseFly45 flew out of the world!
HorseFly34 flew out of the world!
HorseFly51 flew out of the world!
HorseFly32 flew out of the world!
HorseFly36 flew out of the world!
HorseFly78 flew out of the world!
HorseFly19 flew out of the world!
HorseFly37 flew out of the world!
HorseFly14 flew out of the world!
HorseFly25 flew out of the world!
2016-04-16 01:17:40 MH-OrticanMH.KHMBase0.GarbageCollectorTimer: GarbageCollectorInterval=3600 reached, starting Garbage Collector
Collecting garbage
Purging garbage
Garbage: objects: 44620->44404; refs: 1097793
HorseFly79 flew out of the world!
HorseFly33 flew out of the world!
HorseFly46 flew out of the world!
HorseFly11 flew out of the world!
HorseFly2 flew out of the world!
HorseFly7 flew out of the world!
HorseFly29 flew out of the world!
HorseFly31 flew out of the world!
HorseFly16 flew out of the world!
HorseFly84 flew out of the world!
2016-04-16 02:12:17 MH-OrticanMH.KHMBase0.GarbageCollectorTimer: GarbageCollectorInterval=3600 reached, starting Garbage Collector
Collecting garbage
Purging garbage
Garbage: objects: 44291->44291; refs: 1090572
HorseFly28 flew out of the world!
HorseFly9 flew out of the world!
HorseFly91 flew out of the world!
HorseFly3 flew out of the world!
HorseFly53 flew out of the world!
HorseFly41 flew out of the world!
HorseFly76 flew out of the world!
HorseFly54 flew out of the world!
HorseFly50 flew out of the world!
HorseFly8 flew out of the world!
2016-04-16 03:06:53 MH-OrticanMH.KHMBase0.GarbageCollectorTimer: GarbageCollectorInterval=3600 reached, starting Garbage Collector
Collecting garbage
Purging garbage
Garbage: objects: 44269->44269; refs: 1089037
HorseFly23 flew out of the world!
HorseFly59 flew out of the world!
HorseFly56 flew out of the world!
HorseFly72 flew out of the world!
HorseFly13 flew out of the world!
HorseFly21 flew out of the world!
HorseFly26 flew out of the world!
HorseFly12 flew out of the world!
HorseFly58 flew out of the world!
HorseFly43 flew out of the world!
2016-04-16 04:01:28 MH-OrticanMH.KHMBase0.GarbageCollectorTimer: GarbageCollectorInterval=3600 reached, starting Garbage Collector
Collecting garbage
Signal: SIGSEGV [segmentation fault]
Aborting.
Exiting.
Name subsystem shut down
Allocation checking disabled
[2016-04-16 04:01:34] ucc.init: restarting because pid died
<EDIT>
If I try

Code: Select all

log(ConsoleCommand("OBJ LIST"))
I'll get
ucc.init.log wrote:2016-04-17 18:37:42 MH-OrticanMH.KHMBase0.ConsoleCommand OBJ LIST: Objects:Class Count NumKBytes MaxKBytesModel
Signal: SIGSEGV [segmentation fault]
Aborting.
Exiting.
I guess that the resulting string exceeds 1023 chars or the logging function cannot handle line breaks...
</EDIT>
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
Wormbo
Adept
Posts: 258
Joined: Sat Aug 24, 2013 6:04 pm
Contact:

Re: Logging memory stats?

Post by Wormbo »

Use the fact that when a player executes native commands, they end up in the log automatically. The log() function isn't meant to be used to dump a single humongous string to disk. Note that there are two ConsoleCommand() functions, one in Actor returning string (overridden in PlayerPawn) and one in Console returning just bool. Use the latter to write to the log file directly.
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Logging memory stats?

Post by Higor »

Linux crashing post-1023 long strings getting logged make no sense.
Linux TCHAR's are ANSI chars and don't really need to be remapped from UNICODE to ANSI at the moment of writing to file.
It is the remapping buffers that add this limitation after all.

Maybe there's an opposite ANSI to UNICODE remapping being done for a different output device (maybe Terminal screen?).

EDIT:
I did this for Win32 UCC.
viewtopic.php?f=15&t=6601
Never bothered to make a Linux counterpart.
Post Reply