Skip to content

Commit

Permalink
better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Geokureli committed Apr 10, 2024
1 parent acaf943 commit c89a224
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions flixel/util/FlxPool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,10 @@ class FlxPool<T:IFlxDestroyable> implements IFlxPool<T>
if (_pool.length == 0)
preAllocate(1);

id = Type.getClassName(Type.getClass(_pool[0])).split(".").pop().split("Flx").pop();
id = Type.getClassName(Type.getClass(_pool[0])).split(".").pop().split("FlxBase").pop().split("Flx").pop();
}

FlxG.watch.addFunction(id + "-pool", () -> '$length/$_totalCreated');
FlxG.watch.addFunction(id + "-top-leak", function()
FlxG.watch.addFunction(id + "-pool", function()
{
var most = 0;
var topStack:String = null;
Expand All @@ -165,10 +164,10 @@ class FlxPool<T:IFlxDestroyable> implements IFlxPool<T>
}
}

return if (topStack == null)
null;
else
'${prettyStack(topStack)}: $most';
var msg = '$length/$_totalCreated';
if (topStack != null)
msg += ' | $most from ${prettyStack(topStack)}';
return msg;
});
}

Expand Down Expand Up @@ -212,7 +211,7 @@ class FlxPool<T:IFlxDestroyable> implements IFlxPool<T>

inline function prettyStack(pos:String)
{
return pos.split("/").pop().split(".hx").shift();
return pos.split("/").pop().split(".hx").join("");
}
#end
}
Expand Down

0 comments on commit c89a224

Please sign in to comment.