scrapped profiler
This commit is contained in:
@@ -131,11 +131,15 @@
|
||||
<!-- Comment this out to disable build number on FPS -->
|
||||
<define name="SHOW_BUILD_ON_FPS" />
|
||||
|
||||
<!-- Uncomment this out to enable profiler -->
|
||||
<define name="ENABLE_PROFILER" />
|
||||
|
||||
|
||||
<haxedef name="VIDEO_CUTSCENES" if="VIDEO_CUTSCENES" />
|
||||
<haxedef name="UPDATE_CHECKING" if="UPDATE_CHECKING" />
|
||||
<haxedef name="DISCORD_RPC" if="DISCORD_RPC" />
|
||||
<haxedef name="SHOW_BUILD_ON_FPS" if="SHOW_BUILD_ON_FPS" />
|
||||
<haxedef name="ENABLE_PROFILER" if="ENABLE_PROFILER" />
|
||||
<haxeflag name="--macro" value="funkin.macros.StdDeprecationsRemover.init()" />
|
||||
<!-- _______________________________ Libraries ______________________________ -->
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
2204
|
||||
2220
|
||||
@@ -0,0 +1,13 @@
|
||||
package funkin.system;
|
||||
|
||||
import flixel.FlxState;
|
||||
import flixel.FlxGame;
|
||||
|
||||
class FunkinGame extends FlxGame {
|
||||
public function new(gameWidth = 0, gameHeight = 0, ?initialState:Class<FlxState>, updateFramerate = 60, drawFramerate = 60, skipSplash = false, startFullscreen = false) {
|
||||
super(gameWidth, gameHeight, initialState, 1, updateFramerate, drawFramerate, skipSplash, startFullscreen);
|
||||
#if (cpp && ENABLE_PROFILER)
|
||||
cpp.vm.Profiler.start('./profiler.txt');
|
||||
#end
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package funkin.system;
|
||||
|
||||
import flixel.util.FlxDestroyUtil.IFlxDestroyable;
|
||||
import flixel.util.FlxPool;
|
||||
class FunkinProfiler {
|
||||
private static var __pool:FlxPool<FunkinProfilerEvent> = new FlxPool(FunkinProfilerEvent);
|
||||
private static inline function __getEvent(name:String)
|
||||
return __pool.get().set(name);
|
||||
|
||||
public static var events:Array<FunkinProfilerEvent> = [];
|
||||
|
||||
public static function reset() {
|
||||
for(e in events)
|
||||
e.recycle();
|
||||
}
|
||||
|
||||
public static function registerEvent(event:String, level:Int = 0) {
|
||||
var curEventsArray = events;
|
||||
var l:Int = 0;
|
||||
var ev:FunkinProfilerEvent;
|
||||
while(l < level) {
|
||||
ev = curEventsArray.last();
|
||||
if (ev == null)
|
||||
curEventsArray.push(ev = __getEvent("Unknown"));
|
||||
curEventsArray = ev.childs;
|
||||
l++;
|
||||
}
|
||||
|
||||
curEventsArray.push(__getEvent(event));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class FunkinProfilerEvent implements IFlxDestroyable {
|
||||
public var name:String = null;
|
||||
public var childs:Array<FunkinProfilerEvent> = [];
|
||||
|
||||
public function new() {}
|
||||
|
||||
public function set(name:String):FunkinProfilerEvent {
|
||||
this.name = name;
|
||||
if (childs != null)
|
||||
while(childs.length > 0)
|
||||
childs.shift();
|
||||
else
|
||||
childs = [];
|
||||
return this;
|
||||
}
|
||||
|
||||
public function destroy() {
|
||||
name = null;
|
||||
childs = null;
|
||||
}
|
||||
|
||||
public function recycle() {
|
||||
name = null;
|
||||
if (childs != null)
|
||||
for(c in childs)
|
||||
if (c != null)
|
||||
c.recycle();
|
||||
@:privateAccess
|
||||
FunkinProfiler.__pool.put(this);
|
||||
}
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class Main extends Sprite
|
||||
}
|
||||
|
||||
|
||||
addChild(new FlxGame(gameWidth, gameHeight, null, zoom, framerate, framerate, skipSplash, startFullscreen));
|
||||
addChild(new FunkinGame(gameWidth, gameHeight, null, framerate, framerate, skipSplash, startFullscreen));
|
||||
loadGameSettings();
|
||||
// FlxG.switchState(new TitleState());
|
||||
FlxG.switchState(new funkin.menus.BetaWarningState());
|
||||
|
||||
Reference in New Issue
Block a user