Profile categories splitting and descriptions. (#1375)
* Split spawning and random ticks into separate categories * Split blocks into tile ticks and block events * Fix ambiguous call to tick() method Fix package private warning * fix: add missing sections for tile ticks and block events * fix: wrong profiling order * feat: add descriptions to profiler categories * refactor: replace guava ImmutableMap with jdk Map * fix negative time in "rest" category
This commit is contained in:
1 parent
4662a86121
commit
544c1a8327
4 files changed
+135
-57
No files matched your search
@@ -47,69 +47,54 @@ public abstract class ServerLevel_tickMixin extends Level
|
||||
}
|
||||
@Inject(method = "tick", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=chunkSource"
|
||||
args = "stringValue=tickPending"
|
||||
))
|
||||
private void stopWeatherStartChunkSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
private void stopWeatherStartTileTicks(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
{
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
// we go deeper here
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Schedule Ticks", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
}
|
||||
@Inject(method = "tick", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=tickPending"
|
||||
))
|
||||
private void stopChunkStartBlockSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
{
|
||||
// out of chunk
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Blocks", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=raid"
|
||||
))
|
||||
private void stopBlockStartVillageSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
private void stopTileTicksStartRaid(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
{
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Village", CarpetProfiler.TYPE.GENERAL);
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Raid", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=chunkSource"
|
||||
))
|
||||
private void stopVillageSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
private void stopRaid(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
{
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
currentSection = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Inject(method = "tick", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=blockEvents"
|
||||
))
|
||||
private void startBlockAgainSection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
private void startBlockEvents(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
{
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Blocks", CarpetProfiler.TYPE.GENERAL);
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Block Events", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
|
||||
@Inject(method = "tick", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=entities"
|
||||
))
|
||||
private void stopBlockAgainStartEntitySection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
private void stopBlockEventsStartEntitySection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
{
|
||||
if (currentSection != null)
|
||||
{
|
||||
@@ -126,6 +111,45 @@ public abstract class ServerLevel_tickMixin extends Level
|
||||
private void endEntitySection(BooleanSupplier booleanSupplier_1, CallbackInfo ci)
|
||||
{
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
currentSection = null;
|
||||
}
|
||||
|
||||
// Chunk
|
||||
|
||||
@Inject(method = "tickChunk", at = @At("HEAD"))
|
||||
private void startThunderSpawningSection(CallbackInfo ci) {
|
||||
// Counting it in spawning because it's spawning skeleton horses
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Spawning", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunk", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=iceandsnow"
|
||||
))
|
||||
private void endThunderSpawningAndStartIceSnowRandomTicks(CallbackInfo ci) {
|
||||
if (currentSection != null) {
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Environment", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunk", at = @At(
|
||||
value = "CONSTANT",
|
||||
args = "stringValue=tickBlocks"
|
||||
))
|
||||
private void endIceAndSnowAndStartRandomTicks(CallbackInfo ci) {
|
||||
if (currentSection != null) {
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
currentSection = CarpetProfiler.start_section((Level) (Object) this, "Random Ticks", CarpetProfiler.TYPE.GENERAL);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "tickChunk", at = @At("RETURN"))
|
||||
private void endRandomTicks(CallbackInfo ci) {
|
||||
if (currentSection != null) {
|
||||
CarpetProfiler.end_current_section(currentSection);
|
||||
currentSection = null;
|
||||
}
|
||||
}
|
||||
|
||||
//// freeze
|
||||
@@ -181,6 +205,4 @@ public abstract class ServerLevel_tickMixin extends Level
|
||||
{
|
||||
if (TickSpeed.process_entities) runBlockEvents();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user