Skip to content

Commit

Permalink
Client: Add a new CLI switch for profiling the startup time
Browse files Browse the repository at this point in the history
In order to get accurate profiling results, the render loop needs to be stopped immediately after loading the given scene.
  • Loading branch information
rdw-software committed Feb 6, 2024
1 parent 7ab8a54 commit f6e1de5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Core/NativeClient/NativeClient.lua
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ function NativeClient:LoadSceneByID(globallyUniqueSceneID)

local map = RagnarokMap(globallyUniqueSceneID, grfFileSystem) or DebugScene(globallyUniqueSceneID)
Renderer:LoadSceneObjects(map)

if self.isProfilingStartupTime then
os.exit(0, true) -- Job's done
end
end

function NativeClient:LoadScenesOneByOne(delayInMilliseconds)
Expand Down
2 changes: 2 additions & 0 deletions client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ elseif arg[1] == "--stresstest" then
NativeClient:LoadScenesOneByOne(arg[2])
end)
_G.arg[1] = nil -- Don't try to load it as a scene
elseif arg[2] == "--profile" then
NativeClient.isProfilingStartupTime = true
end

local mapID = arg[1]
Expand Down

0 comments on commit f6e1de5

Please sign in to comment.