NetworkSummaryEvent.java
net.minecraft.util.profiling.jfr.event.NetworkSummaryEvent
信息
- 全限定名:net.minecraft.util.profiling.jfr.event.NetworkSummaryEvent
- 类型:public class
- 包:net.minecraft.util.profiling.jfr.event
- 源码路径:src/main/java/net/minecraft/util/profiling/jfr/event/NetworkSummaryEvent.java
- 起始行号:L19
- 继承:Event
- 职责:
TODO
字段/常量
-
EVENT_NAME- 类型:
String - 修饰符:
public static final - 源码定位:
L20 - 说明:
TODO
- 类型:
-
TYPE- 类型:
EventType - 修饰符:
public static final - 源码定位:
L21 - 说明:
TODO
- 类型:
-
remoteAddress- 类型:
String - 修饰符:
public final - 源码定位:
L22 - 说明:
TODO
- 类型:
-
sentBytes- 类型:
long - 修饰符:
public - 源码定位:
L25 - 说明:
TODO
- 类型:
-
sentPackets- 类型:
int - 修饰符:
public - 源码定位:
L29 - 说明:
TODO
- 类型:
-
receivedBytes- 类型:
long - 修饰符:
public - 源码定位:
L32 - 说明:
TODO
- 类型:
-
receivedPackets- 类型:
int - 修饰符:
public - 源码定位:
L36 - 说明:
TODO
- 类型:
内部类/嵌套类型
-
net.minecraft.util.profiling.jfr.event.NetworkSummaryEvent.Fields- 类型:
class - 修饰符:
public static final - 源码定位:
L44 - 说明:
TODO
- 类型:
-
net.minecraft.util.profiling.jfr.event.NetworkSummaryEvent.SumAggregation- 类型:
class - 修饰符:
public static final - 源码定位:
L55 - 说明:
TODO
- 类型:
构造器
public NetworkSummaryEvent(String remoteAddress) @ L40
- 构造器名:NetworkSummaryEvent
- 源码定位:L40
- 修饰符:public
参数:
- remoteAddress: String
说明:
TODO
方法
下面的方法块按源码顺序生成。
- 无
代码
)
@StackTrace(false)
@Period("10 s")
public class NetworkSummaryEvent extends Event {
public static final String EVENT_NAME = "minecraft.NetworkSummary";
public static final EventType TYPE = EventType.getEventType(NetworkSummaryEvent.class);
@Name("remoteAddress")
@Label("Remote Address")
public final String remoteAddress;
@Name("sentBytes")
@Label("Sent Bytes")
@DataAmount
public long sentBytes;
@Name("sentPackets")
@Label("Sent Packets")
public int sentPackets;
@Name("receivedBytes")
@Label("Received Bytes")
@DataAmount
public long receivedBytes;
@Name("receivedPackets")
@Label("Received Packets")
public int receivedPackets;
public NetworkSummaryEvent(String remoteAddress) {
this.remoteAddress = remoteAddress;
}
public static final class Fields {
public static final String REMOTE_ADDRESS = "remoteAddress";
public static final String SENT_BYTES = "sentBytes";
private static final String SENT_PACKETS = "sentPackets";
public static final String RECEIVED_BYTES = "receivedBytes";
private static final String RECEIVED_PACKETS = "receivedPackets";
private Fields() {
}
}
public static final class SumAggregation {
private final AtomicLong sentBytes = new AtomicLong();
private final AtomicInteger sentPackets = new AtomicInteger();
private final AtomicLong receivedBytes = new AtomicLong();
private final AtomicInteger receivedPackets = new AtomicInteger();
private final NetworkSummaryEvent event;
public SumAggregation(String remoteAddress) {
this.event = new NetworkSummaryEvent(remoteAddress);
this.event.begin();
}
public void trackSentPacket(int size) {
this.sentPackets.incrementAndGet();
this.sentBytes.addAndGet(size);
}
public void trackReceivedPacket(int size) {
this.receivedPackets.incrementAndGet();
this.receivedBytes.addAndGet(size);
}
public void commitEvent() {
this.event.sentBytes = this.sentBytes.get();
this.event.sentPackets = this.sentPackets.get();
this.event.receivedBytes = this.receivedBytes.get();
this.event.receivedPackets = this.receivedPackets.get();
this.event.commit();
}
}
}引用的其他类
- 无