profiling work
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit

This commit is contained in:
austin 2025-05-27 12:53:30 -04:00
parent d831509290
commit 8784b08fe4
4 changed files with 22 additions and 2 deletions

View File

@ -2006,6 +2006,7 @@ VectorPool->JomlPool
Major NetArranger architecture rework Major NetArranger architecture rework
No allocations on client receiving chunk of blocks or terrain No allocations on client receiving chunk of blocks or terrain
Meshgen acceleration structure for block meshgen Meshgen acceleration structure for block meshgen
More profiling

View File

@ -218,7 +218,9 @@ public class CursorState {
cursorPos = cursorPos.add(new Vector3d(eyePos).normalize().mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER)); cursorPos = cursorPos.add(new Vector3d(eyePos).normalize().mul(-BlockChunkData.BLOCK_SIZE_MULTIPLIER));
} }
cursorPos.set(this.clampPositionToNearestBlock(cursorPos)); cursorPos.set(this.clampPositionToNearestBlock(cursorPos));
EntityUtils.getPosition(Globals.cursorState.playerBlockCursor).set(cursorPos); if(Globals.cursorState.playerBlockCursor != null){
EntityUtils.getPosition(Globals.cursorState.playerBlockCursor).set(cursorPos);
}
cursorPos.sub(BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0); cursorPos.sub(BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0,BlockChunkData.BLOCK_SIZE_MULTIPLIER / 2.0);
EntityUtils.getPosition(CursorState.playerFabCursor).set(cursorPos); EntityUtils.getPosition(CursorState.playerFabCursor).set(cursorPos);
if(gridAlignmentData != null){ if(gridAlignmentData != null){

View File

@ -77,6 +77,7 @@ public class ServerContentManager {
//Block for macro data generation if relevant //Block for macro data generation if relevant
// //
List<MacroObject> objects = null; List<MacroObject> objects = null;
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - collision check macro data");
if(macroData == null){ if(macroData == null){
objects = new LinkedList<MacroObject>(); objects = new LinkedList<MacroObject>();
} else { } else {
@ -98,6 +99,7 @@ public class ServerContentManager {
throw new Error("Failed to generate content " + notFullResCount + " " + waitCount); throw new Error("Failed to generate content " + notFullResCount + " " + waitCount);
} }
} }
Globals.profiler.endCpuSample();
@ -105,33 +107,48 @@ public class ServerContentManager {
//Actual generation/loading //Actual generation/loading
// //
String fullPath = "/content/" + cellKey + ".dat"; String fullPath = "/content/" + cellKey + ".dat";
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - Actual generation/loading");
if(generateContent){ //in other words, if not arena mode if(generateContent){ //in other words, if not arena mode
if(FileUtils.checkSavePathExists(Globals.serverState.currentSave.getName(), fullPath)){ if(FileUtils.checkSavePathExists(Globals.serverState.currentSave.getName(), fullPath)){
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - Load from existing key");
//if on disk (has already been generated) //if on disk (has already been generated)
ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.serverState.currentSave.getName(), fullPath, ContentSerialization.class); ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.serverState.currentSave.getName(), fullPath, ContentSerialization.class);
contentRaw.hydrateRawContent(realm,cell); contentRaw.hydrateRawContent(realm,cell);
Globals.profiler.endCpuSample();
} else { } else {
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - Generate from scratch");
//else create from scratch //else create from scratch
ServerContentGenerator.generateContent(realm, this.macroData, cell, worldPos, HashUtils.hashIVec(worldPos.x, worldPos.y, worldPos.z)); ServerContentGenerator.generateContent(realm, this.macroData, cell, worldPos, HashUtils.hashIVec(worldPos.x, worldPos.y, worldPos.z));
Globals.profiler.endCpuSample();
} }
} else { } else {
//just because content wasn't generated doesn't mean there isn't data saved under that key //just because content wasn't generated doesn't mean there isn't data saved under that key
if(FileUtils.checkSavePathExists(Globals.serverState.currentSave.getName(), fullPath)){ if(FileUtils.checkSavePathExists(Globals.serverState.currentSave.getName(), fullPath)){
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - Load from on-disk file without key");
//if on disk (has already been generated) //if on disk (has already been generated)
ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.serverState.currentSave.getName(), fullPath, ContentSerialization.class); ContentSerialization contentRaw = FileUtils.loadObjectFromSavePath(Globals.serverState.currentSave.getName(), fullPath, ContentSerialization.class);
contentRaw.hydrateRawContent(realm,cell); contentRaw.hydrateRawContent(realm,cell);
Globals.profiler.endCpuSample();
} }
} }
Globals.profiler.endCpuSample();
//checking for null because there are cases where we might not have macro data to instantiate from //checking for null because there are cases where we might not have macro data to instantiate from
//ie, if we load an asset-defined (not save-defined) scene that does not have save data //ie, if we load an asset-defined (not save-defined) scene that does not have save data
//ie, imagine a puzzle room or something like that //ie, imagine a puzzle room or something like that
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - Macro data");
if(macroData != null){ if(macroData != null){
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - Get nearby characters");
List<Character> nearbyCharacters = Globals.serverState.characterService.getCharacters(worldPos); List<Character> nearbyCharacters = Globals.serverState.characterService.getCharacters(worldPos);
Globals.profiler.endCpuSample();
Globals.profiler.beginCpuSample("ServerContentManager.generateContentForDataCell - Spawn characters");
for(Character character : nearbyCharacters){ for(Character character : nearbyCharacters){
this.spawnMacroObject(realm, character); this.spawnMacroObject(realm, character);
} }
Globals.profiler.endCpuSample();
} }
Globals.profiler.endCpuSample(); Globals.profiler.endCpuSample();
Globals.profiler.endCpuSample();
} }
/** /**

View File

@ -213,7 +213,7 @@ public class CharacterService extends SignalServiceImpl {
*/ */
public List<Character> getCharacters(Vector3i worldPos){ public List<Character> getCharacters(Vector3i worldPos){
List<Character> rVal = new LinkedList<Character>(); List<Character> rVal = new LinkedList<Character>();
List<Character> allCharacters = this.getAllCharacters(); List<Character> allCharacters = this.getLoadedCharacters();
for(Character character : allCharacters){ for(Character character : allCharacters){
if(ServerWorldData.convertRealToChunkSpace(character.getPos()).equals(worldPos.x, worldPos.y, worldPos.z)){ if(ServerWorldData.convertRealToChunkSpace(character.getPos()).equals(worldPos.x, worldPos.y, worldPos.z)){
rVal.add(character); rVal.add(character);