2019-12-12 01:57 CET

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0005960Spring engineGeneralpublic2018-04-16 02:39
Assigned ToKloot 
Product Version104.0 +git 
Target VersionFixed in Version104.0 +git 
Summary0005960: unsynced callout to to get mem usage of all lua states
Description[08:08:10] <[Fx]Bluestone> i think there should be a way to measure synced mem usage though
[08:08:10] <Nightwatch> <ashdnazg#5048> that's a good idea
[08:08:10] <Nightwatch> <ashdnazg#5048> an unsynced lua callout
[08:08:10] <Nightwatch> <ashdnazg#5048> to get memory usage of all lua states

(to allow profiling mem allocation by synced gadgets)
TagsNo tags attached.
Checked infolog.txt for Errors
Attached Files




Kloot (developer)

already exists, Spring.GetLuaMemUsage


silentwings (reporter)

Thanks! That does everything I was looking for except one small detail - since the callout is for unsynced lusstates only, I can't see a way to read (into an unsynced luastate) the amount of mem/allocs by (specifically) synced luarules.


silentwings (reporter)

Addendum: I think that the obvious soln of returning a table would be a bad idea because the profilers now call Spring.GetLuaMemUsage() one hell of a lot.

Perhaps an additional callout Spring.GetSyncedLuaMemUsage() returning the obvious two/four args, would be best. I would offer to write it but I don't have a build env set up atm.


Kloot (developer)

there is one roundabout way to get the synced footprint:

1) for each unsynced state, send out the (local, global) results of GetLuaMemUsage via SendLua*Message
2) in the receiving gadget's RecvLuaMsg, forward these via Spring.SendToUnsynced
3) in RecvFromSynced, subtract sum(unsynced states) from the global footprint

with some hackery the summing part could also be done directly inside GetLuaMemUsage.


silentwings (reporter)

I had thought of the roundabout way, but decided against it (its a bit awkward for a profiler running during an online game, which might be turned on/off by multiple users in a random sequence).

> with some hackery the summing part could also be done directly inside GetLuaMemUsage.
Wouldn't it be easier for an unsynced callout to trigger C++ code that called the collectgarbage("count") function of synced luarules and sent the result back into unsynced land? Or am I overestimating how easily the luastates can get hold of each others pointers?


Kloot (developer)

Last edited: 2018-04-15 18:27

View 2 revisions

right now states can not see each other (which is where the hack comes in), but once they do have access summing over the unsynced or the synced set (LuaRules + LuaGaia) will just be a detail.


Kloot (developer)

Last edited: 2018-04-16 02:39

View 2 revisions

I think 5587a2d2 + 7f43675f should cover it.


-Issue History
Date Modified Username Field Change
2018-04-15 09:10 silentwings New Issue
2018-04-15 11:05 Kloot Assigned To => Kloot
2018-04-15 11:05 Kloot Status new => resolved
2018-04-15 11:05 Kloot Resolution open => fixed
2018-04-15 11:05 Kloot Note Added: 0019020
2018-04-15 16:51 silentwings Status resolved => feedback
2018-04-15 16:51 silentwings Resolution fixed => reopened
2018-04-15 16:51 silentwings Note Added: 0019022
2018-04-15 16:54 silentwings Note Added: 0019023
2018-04-15 16:54 silentwings Status feedback => assigned
2018-04-15 17:24 Kloot Note Added: 0019024
2018-04-15 17:50 silentwings Note Added: 0019025
2018-04-15 18:27 Kloot Note Added: 0019026
2018-04-15 18:27 Kloot Note Edited: 0019026 View Revisions
2018-04-16 02:09 Kloot Note Added: 0019030
2018-04-16 02:09 Kloot Status assigned => resolved
2018-04-16 02:09 Kloot Resolution reopened => fixed
2018-04-16 02:09 Kloot Fixed in Version => 104.0 +git
2018-04-16 02:39 Kloot Note Edited: 0019030 View Revisions
+Issue History