Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion jni/src/native_peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,9 @@ JNIEXPORT jobject JNICALL Java_tel_schich_libdatachannel_LibDataChannelNative_rt
static_cast<jlong>(stats.congestionWindow), static_cast<jlong>(stats.peerReceiveWindow),
static_cast<jlong>(stats.unackedChunks), static_cast<jlong>(stats.pendingChunks),
static_cast<jlong>(stats.dataTimeouts), static_cast<jlong>(stats.sendQueueBytes),
static_cast<jlong>(stats.sendBufferSize), static_cast<jlong>(stats.receiveQueueBytes));
static_cast<jlong>(stats.sendBufferSize), static_cast<jlong>(stats.receiveQueueBytes),
static_cast<jlong>(stats.fastRetransmits), static_cast<jlong>(stats.retransmittedChunks),
static_cast<jlong>(stats.gapSacks), static_cast<jlong>(stats.duplicateTsnsReceived));
}

JNIEXPORT jint JNICALL Java_tel_schich_libdatachannel_LibDataChannelNative_rtcSetLocalDescriptionWithIce(
Expand Down
30 changes: 25 additions & 5 deletions src/main/java/tel/schich/libdatachannel/SctpStats.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
public final class SctpStats {
private final Duration rtt, rto;
private final long congestionWindow, peerReceiveWindow, unackedChunks, pendingChunks, dataTimeouts,
sendQueueBytes, sendBufferSize, receiveQueueBytes;
sendQueueBytes, sendBufferSize, receiveQueueBytes, fastRetransmits, retransmittedChunks, gapSacks,
duplicateTsnsReceived;

private SctpStats(Duration rtt, Duration rto, long congestionWindow, long peerReceiveWindow,
long unackedChunks, long pendingChunks, long dataTimeouts, long sendQueueBytes,
long sendBufferSize, long receiveQueueBytes) {
long sendBufferSize, long receiveQueueBytes, long fastRetransmits,
long retransmittedChunks, long gapSacks, long duplicateTsnsReceived) {
this.rtt = rtt;
this.rto = rto;
this.congestionWindow = congestionWindow;
Expand All @@ -23,15 +25,20 @@ private SctpStats(Duration rtt, Duration rto, long congestionWindow, long peerRe
this.sendQueueBytes = sendQueueBytes;
this.sendBufferSize = sendBufferSize;
this.receiveQueueBytes = receiveQueueBytes;
this.fastRetransmits = fastRetransmits;
this.retransmittedChunks = retransmittedChunks;
this.gapSacks = gapSacks;
this.duplicateTsnsReceived = duplicateTsnsReceived;
}

@JNIAccess
static SctpStats create(int rttMillis, int rtoMillis, long congestionWindow, long peerReceiveWindow,
long unackedChunks, long pendingChunks, long dataTimeouts, long sendQueueBytes,
long sendBufferSize, long receiveQueueBytes) {
long sendBufferSize, long receiveQueueBytes, long fastRetransmits,
long retransmittedChunks, long gapSacks, long duplicateTsnsReceived) {
return new SctpStats(Duration.ofMillis(rttMillis), Duration.ofMillis(rtoMillis), congestionWindow,
peerReceiveWindow, unackedChunks, pendingChunks, dataTimeouts, sendQueueBytes, sendBufferSize,
receiveQueueBytes);
receiveQueueBytes, fastRetransmits, retransmittedChunks, gapSacks, duplicateTsnsReceived);
}

/** Smoothed round trip time in whole milliseconds, zero until sampled or while under one. */
Expand All @@ -54,12 +61,25 @@ static SctpStats create(int rttMillis, int rtoMillis, long congestionWindow, lon
public long sendBufferSize() { return sendBufferSize; }
/** Received bytes waiting for reassembly or ordering. */
public long receiveQueueBytes() { return receiveQueueBytes; }
/**
* Packets sent by fast retransmit, after the peer reported gaps. Each halves the congestion window, so where
* these run ahead of what the path lost, the peer is reporting gaps for data that arrived.
*/
public long fastRetransmits() { return fastRetransmits; }
/** DATA chunks sent again, by fast retransmit or after a retransmission timeout. */
public long retransmittedChunks() { return retransmittedChunks; }
/** SACKs received that reported gaps in what the peer had. */
public long gapSacks() { return gapSacks; }
/** DATA chunks received that had arrived already, so the peer resent what it need not have. */
public long duplicateTsnsReceived() { return duplicateTsnsReceived; }

@Override
public String toString() {
return "SctpStats{rtt=" + rtt.toMillis() + "ms, rto=" + rto.toMillis() + "ms, congestionWindow=" +
congestionWindow + ", peerReceiveWindow=" + peerReceiveWindow + ", unackedChunks=" + unackedChunks +
", pendingChunks=" + pendingChunks + ", dataTimeouts=" + dataTimeouts + ", sendQueueBytes=" +
sendQueueBytes + ", sendBufferSize=" + sendBufferSize + ", receiveQueueBytes=" + receiveQueueBytes + "}";
sendQueueBytes + ", sendBufferSize=" + sendBufferSize + ", receiveQueueBytes=" + receiveQueueBytes +
", fastRetransmits=" + fastRetransmits + ", retransmittedChunks=" + retransmittedChunks + ", gapSacks=" +
gapSacks + ", duplicateTsnsReceived=" + duplicateTsnsReceived + "}";
}
}
Loading