Skip to content

Commit 2ab868b

Browse files
committed
Merge branch 'timings'
2 parents 4f88a0a + ce8a2dd commit 2ab868b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+7
-1853
lines changed

src/main/java/cn/nukkit/Player.java

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@
7878
import cn.nukkit.resourcepacks.ResourcePack;
7979
import cn.nukkit.scheduler.AsyncTask;
8080
import cn.nukkit.utils.*;
81-
import co.aikar.timings.Timing;
82-
import co.aikar.timings.Timings;
8381
import com.google.common.collect.BiMap;
8482
import com.google.common.collect.HashBiMap;
8583
import com.google.common.primitives.Floats;
@@ -955,14 +953,11 @@ protected void sendNextChunk() {
955953
return;
956954
}
957955

958-
Timings.playerChunkSendTimer.startTiming();
959-
960956
this.sendQueuedChunk();
961957

962958
if ((this.canDoFirstSpawn() || System.currentTimeMillis() - this.creationTime > 15000) && !this.spawned && this.teleportPosition == null) {
963959
this.doFirstSpawn();
964960
}
965-
Timings.playerChunkSendTimer.stopTiming();
966961
}
967962

968963
protected boolean canDoFirstSpawn() {
@@ -1130,8 +1125,6 @@ protected boolean orderChunks() {
11301125
return false;
11311126
}
11321127

1133-
Timings.playerChunkOrderTimer.startTiming();
1134-
11351128
this.nextChunkOrderRun = 200;
11361129

11371130
loadQueue.clear();
@@ -1164,7 +1157,6 @@ protected boolean orderChunks() {
11641157
this.unloadChunk(Level.getHashX(index), Level.getHashZ(index));
11651158
}
11661159

1167-
Timings.playerChunkOrderTimer.stopTiming();
11681160
return true;
11691161
}
11701162

@@ -1185,7 +1177,7 @@ public boolean dataPacket(DataPacket packet) {
11851177
return false;
11861178
}
11871179

1188-
try (Timing timing = Timings.getSendDataPacketTiming(packet)) {
1180+
{
11891181
DataPacketSendEvent ev = new DataPacketSendEvent(this, packet);
11901182
this.server.getPluginManager().callEvent(ev);
11911183
if (ev.isCancelled()) {
@@ -1515,8 +1507,6 @@ public boolean fastMove(double dx, double dy, double dz) {
15151507
return true;
15161508
}
15171509

1518-
Timings.entityMoveTimer.startTiming();
1519-
15201510
AxisAlignedBB newBB = this.boundingBox.getOffsetBoundingBox(dx, dy, dz);
15211511

15221512
if (this.isSpectator() || server.getAllowFlight() || !this.level.hasCollision(this, newBB, false)) {
@@ -1562,7 +1552,6 @@ public boolean fastMove(double dx, double dy, double dz) {
15621552
this.motionZ = dz;*/
15631553
}
15641554

1565-
Timings.entityMoveTimer.stopTiming();
15661555
return true;
15671556
}
15681557

@@ -2128,8 +2117,6 @@ public void checkInteractNearby() {
21282117
* @return Entity|null either NULL if no entity is found or an instance of the entity
21292118
*/
21302119
public EntityInteractable getEntityPlayerLookingAt(int maxDistance) {
2131-
timing.startTiming();
2132-
21332120
EntityInteractable entity = null;
21342121

21352122
// just a fix because player MAY not be fully initialized
@@ -2154,7 +2141,6 @@ public EntityInteractable getEntityPlayerLookingAt(int maxDistance) {
21542141
}
21552142
}
21562143

2157-
timing.stopTiming();
21582144

21592145
return entity;
21602146
}
@@ -2454,16 +2440,14 @@ public void handleDataPacket(DataPacket packet) {
24542440
return;
24552441
}
24562442

2457-
try (Timing timing = Timings.getReceiveDataPacketTiming(packet)) {
2443+
{
24582444
DataPacketReceiveEvent ev = new DataPacketReceiveEvent(this, packet);
24592445
this.server.getPluginManager().callEvent(ev);
24602446
if (ev.isCancelled()) {
2461-
timing.stopTiming();
24622447
return;
24632448
}
24642449

24652450
if (packet.pid() == ProtocolInfo.BATCH_PACKET) {
2466-
timing.stopTiming();
24672451
// this.server.getNetwork().processBatch((BatchPacket) packet, this);
24682452
// Batch packets are already decoded in Synapse
24692453
onPacketViolation(PacketViolationReason.NESTED_BATCH);
@@ -3226,9 +3210,7 @@ public void onCompletion(Server server) {
32263210
break;
32273211
}
32283212

3229-
Timings.playerCommandTimer.startTiming();
32303213
this.server.dispatchCommand(playerCommandPreprocessEvent.getPlayer(), playerCommandPreprocessEvent.getMessage().substring(1));
3231-
Timings.playerCommandTimer.stopTiming();
32323214
break;
32333215
case ProtocolInfo.TEXT_PACKET:
32343216
if (!this.spawned || !this.isAlive()) {

src/main/java/cn/nukkit/Server.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@
7171
import cn.nukkit.scheduler.ServerScheduler;
7272
import cn.nukkit.utils.*;
7373
import cn.nukkit.utils.bugreport.ExceptionHandler;
74-
import co.aikar.timings.Timings;
7574
import com.dosse.upnp.UPnP;
7675
import com.google.common.base.Preconditions;
7776
import io.netty.buffer.ByteBuf;
@@ -659,12 +658,10 @@ public void batchPackets(Player[] players, DataPacket[] packets, boolean forceSy
659658
if (players == null || packets == null || players.length == 0 || packets.length == 0) {
660659
return;
661660
}
662-
Timings.playerNetworkSendTimer.startTiming();
663661

664662
BatchPacketsEvent ev = new BatchPacketsEvent(players, packets, forceSync);
665663
getPluginManager().callEvent(ev);
666664
if (ev.isCancelled()) {
667-
Timings.playerNetworkSendTimer.stopTiming();
668665
return;
669666
}
670667

@@ -700,7 +697,6 @@ public void batchPackets(Player[] players, DataPacket[] packets, boolean forceSy
700697
throw new RuntimeException(e);
701698
}
702699
}
703-
Timings.playerNetworkSendTimer.stopTiming();
704700
}
705701

706702
public void broadcastPacketsCallback(byte[] data, List<InetSocketAddress> targets) {
@@ -804,7 +800,6 @@ public void reload() {
804800
this.pluginManager.loadPlugins(this.pluginPath);
805801
this.enablePlugins(PluginLoadOrder.STARTUP);
806802
this.enablePlugins(PluginLoadOrder.POSTWORLD);
807-
Timings.reset();
808803
}
809804

810805
public void shutdown() {
@@ -861,8 +856,6 @@ public void forceShutdown() {
861856
this.network.unregisterInterface(interfaz);
862857
}
863858

864-
log.debug("Disabling timings");
865-
Timings.stopServer();
866859
if (this.watchdog != null) {
867860
this.watchdog.kill();
868861
}
@@ -1125,7 +1118,6 @@ private void checkTickUpdates(int currentTick, long tickTime) {
11251118

11261119
public void doAutoSave() {
11271120
if (this.getAutoSave()) {
1128-
Timings.levelSaveTimer.startTiming();
11291121
for (Player player : new ArrayList<>(this.players.values())) {
11301122
if (player.isOnline()) {
11311123
player.save(true);
@@ -1137,7 +1129,6 @@ public void doAutoSave() {
11371129
for (Level level : this.getLevels().values()) {
11381130
level.save();
11391131
}
1140-
Timings.levelSaveTimer.stopTiming();
11411132
}
11421133
}
11431134

@@ -1148,21 +1139,15 @@ private boolean tick() {
11481139
return false;
11491140
}
11501141

1151-
Timings.fullServerTickTimer.startTiming();
1152-
11531142
++this.tickCounter;
11541143

1155-
Timings.connectionTimer.startTiming();
11561144
this.network.processInterfaces();
11571145

11581146
if (this.rcon != null) {
11591147
this.rcon.check();
11601148
}
1161-
Timings.connectionTimer.stopTiming();
11621149

1163-
Timings.schedulerTimer.startTiming();
11641150
this.scheduler.mainThreadHeartbeat(this.tickCounter);
1165-
Timings.schedulerTimer.stopTiming();
11661151

11671152
this.checkTickUpdates(this.tickCounter, tickTime);
11681153

@@ -1206,7 +1191,6 @@ private boolean tick() {
12061191
}
12071192
}
12081193

1209-
Timings.fullServerTickTimer.stopTiming();
12101194
//long now = System.currentTimeMillis();
12111195
long nowNano = System.nanoTime();
12121196
//float tick = Math.min(20, 1000 / Math.max(1, now - tickTime));

src/main/java/cn/nukkit/blockentity/BlockEntity.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
import cn.nukkit.math.Vector3;
99
import cn.nukkit.nbt.tag.CompoundTag;
1010
import cn.nukkit.utils.ChunkException;
11-
import co.aikar.timings.Timing;
12-
import co.aikar.timings.Timings;
1311
import com.google.common.collect.BiMap;
1412
import com.google.common.collect.HashBiMap;
1513
import lombok.extern.log4j.Log4j2;
@@ -36,14 +34,12 @@ public abstract class BlockEntity extends Position implements BlockEntityID {
3634

3735
protected int lastUpdate;
3836
protected Server server;
39-
protected Timing timing;
4037

4138
public BlockEntity(FullChunk chunk, CompoundTag nbt) {
4239
if (chunk == null || chunk.getProvider() == null) {
4340
throw new ChunkException("Invalid garbage Chunk given to Block Entity");
4441
}
4542

46-
this.timing = Timings.getBlockEntityTiming(this);
4743
this.server = chunk.getProvider().getLevel().getServer();
4844
this.chunk = chunk;
4945
this.setLevel(chunk.getProvider().getLevel());

src/main/java/cn/nukkit/blockentity/BlockEntityBrewingStand.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ public boolean onUpdate() {
162162
return true;
163163
}
164164
lastUpdate = currentTick;
165-
timing.startTiming();
166165

167166
boolean hasUpdate = false;
168167

@@ -208,7 +207,6 @@ public boolean onUpdate() {
208207
this.server.getPluginManager().callEvent(e);
209208
if (e.isCancelled()) {
210209
brewing = false;
211-
timing.stopTiming();
212210
return false;
213211
}
214212
}
@@ -257,7 +255,6 @@ public boolean onUpdate() {
257255
}
258256
brewing = canBrew;
259257

260-
timing.stopTiming();
261258
return hasUpdate;
262259
}
263260

src/main/java/cn/nukkit/blockentity/BlockEntityCampfire.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ public boolean onUpdate() {
8787
return true;
8888
}
8989
lastUpdate = currentTick;
90-
timing.startTiming();
9190

9291
if (!canCooking()) {
93-
timing.stopTiming();
9492
return false;
9593
}
9694

@@ -140,7 +138,6 @@ public boolean onUpdate() {
140138
level.addLevelSoundEvent(add(0.5, 0.2, 0.5), LevelSoundEventPacket.SOUND_BLOCK_CAMPFIRE_CRACKLE);
141139
}
142140

143-
timing.stopTiming();
144141
return true;
145142
}
146143

src/main/java/cn/nukkit/blockentity/BlockEntityFurnace.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ public boolean onUpdate() {
227227
return true;
228228
}
229229
lastUpdate = currentTick;
230-
this.timing.startTiming();
231230

232231
boolean ret = false;
233232
Item fuel = this.inventory.getFuel();
@@ -310,8 +309,6 @@ public boolean onUpdate() {
310309
}
311310
}
312311

313-
this.timing.stopTiming();
314-
315312
return ret;
316313
}
317314

src/main/java/cn/nukkit/command/Command.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import cn.nukkit.lang.TranslationContainer;
88
import cn.nukkit.permission.Permissible;
99
import cn.nukkit.utils.TextFormat;
10-
import co.aikar.timings.Timing;
11-
import co.aikar.timings.Timings;
1210
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
1311
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
1412

@@ -44,8 +42,6 @@ public abstract class Command {
4442

4543
protected Map<String, CommandParameter[]> commandParameters = new Object2ObjectOpenHashMap<>();
4644

47-
public Timing timing;
48-
4945
public Command(String name) {
5046
this(name, "", null, new String[0]);
5147
}
@@ -72,7 +68,6 @@ public Command(String name, String description, String usageMessage, String... a
7268
}
7369
this.aliases = aliases;
7470
this.activeAliases = aliases;
75-
this.timing = Timings.getCommandTiming(this);
7671
this.commandParameters.put("default", new CommandParameter[]{CommandParameter.newType("args", true, CommandParamType.RAWTEXT)});
7772
}
7873

@@ -191,7 +186,6 @@ public boolean setLabel(String name) {
191186
this.nextLabel = name;
192187
if (!this.isRegistered()) {
193188
this.label = name;
194-
this.timing = Timings.getCommandTiming(this);
195189
return true;
196190
}
197191
return false;

src/main/java/cn/nukkit/command/SimpleCommandMap.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ private void setDefaultCommands() {
9191
// if ((boolean) this.server.getConfig("debug.commands", false)) {
9292
this.register("nukkit", new StatusCommand("status"));
9393
this.register("nukkit", new GarbageCollectorCommand("gc"));
94-
this.register("nukkit", new TimingsCommand("timings"));
9594
//this.register("nukkit", new DumpMemoryCommand("dumpmemory"));
9695
// }
9796

@@ -275,7 +274,6 @@ public boolean dispatch(CommandSender sender, String cmdLine) {
275274
return false;
276275
}
277276

278-
target.timing.startTiming();
279277
try {
280278
target.execute(sender, sentCommandLabel, args);
281279
} catch (Exception e) {
@@ -286,7 +284,6 @@ public boolean dispatch(CommandSender sender, String cmdLine) {
286284
logger.logException(e);
287285
}
288286
}
289-
target.timing.stopTiming();
290287

291288
return true;
292289
}

0 commit comments

Comments
 (0)