mirror of
https://github.com/GTNewHorizons/Opis.git
synced 2026-11-27 15:33:09 +00:00
Added a list of threads in the debug screen.
This commit is contained in:
1 parent
c34e23d74f
commit
cf4aea709f
5 files changed
+81
-1
No files matched your search
@@ -22,6 +22,7 @@ import mcp.mobius.opis.data.holders.basetypes.CoordinatesChunk;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialDouble;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialInt;
|
||||
import mcp.mobius.opis.data.holders.basetypes.SerialLong;
|
||||
import mcp.mobius.opis.data.holders.newtypes.CachedString;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataDimension;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataPacket;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataPacket250;
|
||||
@@ -97,7 +98,13 @@ public enum OpisServerTickHandler implements ITickHandler {
|
||||
cachedAccess.put(player, PlayerTracker.instance().getPlayerAccessLevel(player));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ArrayList<CachedString> threads = new ArrayList<CachedString>();
|
||||
for (Thread t : Thread.getAllStackTraces().keySet()){
|
||||
threads.add(new CachedString(t.getName()));
|
||||
}
|
||||
OpisPacketHandler.sendPacketToAllSwing(NetDataList.create(Message.LIST_THREADS, threads));
|
||||
|
||||
// Dimension data update.
|
||||
ArrayList<DataDimension> dimData = new ArrayList<DataDimension>();
|
||||
for (int dim : DimensionManager.getIDs()){
|
||||
|
||||
@@ -32,6 +32,7 @@ public enum Message {
|
||||
LIST_PACKETS_INBOUND_250 (EnumSet.of(SelectedTab.PACKETINBOUND250)),
|
||||
LIST_ORPHAN_TILEENTS,
|
||||
LIST_ORPHAN_TILEENTS_CLEAR,
|
||||
LIST_THREADS (EnumSet.of(SelectedTab.THREADS)),
|
||||
|
||||
VALUE_TIMING_TILEENTS,
|
||||
VALUE_TIMING_ENTITIES,
|
||||
|
||||
@@ -34,6 +34,7 @@ import mcp.mobius.opis.network.packets.server.NetDataRaw;
|
||||
import mcp.mobius.opis.swing.SwingUI;
|
||||
import mcp.mobius.opis.swing.panels.PanelSummary;
|
||||
import mcp.mobius.opis.swing.panels.debug.PanelOrphanTileEntities;
|
||||
import mcp.mobius.opis.swing.panels.debug.PanelThreads;
|
||||
import mcp.mobius.opis.swing.panels.network.PanelInbound;
|
||||
import mcp.mobius.opis.swing.panels.network.PanelInbound250;
|
||||
import mcp.mobius.opis.swing.panels.network.PanelOutbound;
|
||||
@@ -106,6 +107,7 @@ public class ProxyClient extends ProxyServer implements IMessageHandler{
|
||||
|
||||
TabPanelRegistrar.INSTANCE.registerSection("Debug");
|
||||
IMessageHandler panelOrphanTileEnts = (IMessageHandler)TabPanelRegistrar.INSTANCE.registerTab(new PanelOrphanTileEntities(), "Orphan TileEnts", "Debug");
|
||||
IMessageHandler panelThreads = (IMessageHandler)TabPanelRegistrar.INSTANCE.registerTab(new PanelThreads(), "Threads", "Debug");
|
||||
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.LIST_PLAYERS, panelPlayers);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.LIST_AMOUNT_ENTITIES, panelAmountEntities);
|
||||
@@ -186,6 +188,8 @@ public class ProxyClient extends ProxyServer implements IMessageHandler{
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.LIST_ORPHAN_TILEENTS_CLEAR, panelOrphanTileEnts);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.LIST_ORPHAN_TILEENTS, panelOrphanTileEnts);
|
||||
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.LIST_THREADS, panelThreads);
|
||||
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.CLIENT_CLEAR_SELECTION, modOpis.proxy);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.CLIENT_START_PROFILING, modOpis.proxy);
|
||||
MessageHandlerRegistrar.INSTANCE.registerHandler(Message.CLIENT_SHOW_RENDER_TICK, modOpis.proxy);
|
||||
|
||||
@@ -23,6 +23,7 @@ public enum SelectedTab {
|
||||
ORPHANTES,
|
||||
RENDERHANDLERS,
|
||||
CLIENTEVENTS,
|
||||
THREADS,
|
||||
ANY,
|
||||
NONE;
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package mcp.mobius.opis.swing.panels.debug;
|
||||
|
||||
import mcp.mobius.opis.api.ITabPanel;
|
||||
import mcp.mobius.opis.data.holders.newtypes.CachedString;
|
||||
import mcp.mobius.opis.data.holders.newtypes.DataTileEntity;
|
||||
import mcp.mobius.opis.network.enums.Message;
|
||||
import mcp.mobius.opis.network.packets.server.NetDataRaw;
|
||||
import mcp.mobius.opis.swing.SelectedTab;
|
||||
import mcp.mobius.opis.swing.actions.ActionOrphanTileEntities;
|
||||
import mcp.mobius.opis.swing.widgets.JPanelMsgHandler;
|
||||
import mcp.mobius.opis.swing.widgets.JTableStats;
|
||||
import net.miginfocom.swing.MigLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
public class PanelThreads extends JPanelMsgHandler implements ITabPanel {
|
||||
|
||||
public PanelThreads() {
|
||||
setLayout(new MigLayout("", "[grow]", "[grow]"));
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
add(scrollPane, "cell 0 0,grow");
|
||||
|
||||
table = new JTableStats(
|
||||
new String[] {"Name"},
|
||||
new Class[] {CachedString.class},
|
||||
new int[] {SwingConstants.LEFT}
|
||||
);
|
||||
scrollPane.setViewportView(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleMessage(Message msg, NetDataRaw rawdata) {
|
||||
switch(msg){
|
||||
case LIST_THREADS:{
|
||||
|
||||
((JTableStats)this.getTable()).setTableData(rawdata.array);
|
||||
|
||||
DefaultTableModel model = (DefaultTableModel)this.getTable().getModel();
|
||||
int row = this.getTable().clearTable(CachedString.class);
|
||||
|
||||
for (Object o : rawdata.array){
|
||||
CachedString data = (CachedString)o;
|
||||
model.addRow(new Object[] { data });
|
||||
}
|
||||
|
||||
this.getTable().dataUpdated(row);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SelectedTab getSelectedTab() {
|
||||
return SelectedTab.THREADS;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user