Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
Add jitter to Stream Stats in the GUI
Browse files Browse the repository at this point in the history
These are the GUI side changes to the jitter server side changes committed
earlier.
  • Loading branch information
pstavirs committed Jun 26, 2023
1 parent a273464 commit bfda96a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 12 additions & 1 deletion client/streamstatsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ enum {
kAvgTxBitRate,
kAvgRxBitRate,
kAvgLatency,
kAvgJitter,
kMaxAggrStreamStats
};
static QStringList aggrStatTitles = QStringList()
Expand All @@ -63,7 +64,8 @@ static QStringList aggrStatTitles = QStringList()
<< "Avg\nRx PktRate"
<< "Avg\nTx BitRate"
<< "Avg\nRx BitRate"
<< "Avg\nLatency";
<< "Avg\nLatency"
<< "Avg\nJitter";

static const uint kAggrGuid = 0xffffffff;

Expand Down Expand Up @@ -192,6 +194,12 @@ QVariant StreamStatsModel::data(const QModelIndex &index, int role) const
XLocale().toTimeIntervalString(
aggrGuidStats_.value(guid).latencySum
/ aggrGuidStats_.value(guid).latencyCount);
case kAvgJitter:
return aggrGuidStats_.value(guid).latencyCount <= 0
|| aggrGuidStats_.value(guid).latencySum <= 0 ? QString("-") :
XLocale().toTimeIntervalString(
aggrGuidStats_.value(guid).jitterSum
/ aggrGuidStats_.value(guid).latencyCount);
default:
break;
};
Expand Down Expand Up @@ -267,6 +275,7 @@ void StreamStatsModel::appendStreamStatsList(
ss.rxBytes = s.rx_bytes();
ss.txBytes = s.tx_bytes();
ss.rxLatency = s.latency();
ss.rxJitter = s.jitter();

aggrPort.rxPkts += ss.rxPkts;
aggrPort.txPkts += ss.txPkts;
Expand All @@ -282,6 +291,7 @@ void StreamStatsModel::appendStreamStatsList(
aggrGuid.txDuration = s.tx_duration(); // XXX: use largest or avg?
if (ss.rxLatency) {
aggrGuid.latencySum += ss.rxLatency;
aggrGuid.jitterSum += ss.rxJitter;
aggrGuid.latencyCount++;
}

Expand All @@ -294,6 +304,7 @@ void StreamStatsModel::appendStreamStatsList(
aggrAggr.txDuration = aggrGuid.txDuration;
if (ss.rxLatency) {
aggrAggr.latencySum += ss.rxLatency;
aggrAggr.jitterSum += ss.rxJitter;
aggrAggr.latencyCount++;
}

Expand Down
2 changes: 2 additions & 0 deletions client/streamstatsmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public slots:
quint64 rxBytes;
quint64 txBytes;
quint64 rxLatency;
quint64 rxJitter;
};
struct AggrGuidStats {
quint64 rxPkts;
Expand All @@ -67,6 +68,7 @@ public slots:
qint64 pktLoss;
double txDuration;
quint64 latencySum;
quint64 jitterSum;
uint latencyCount;
};
QList<Guid> guidList_;
Expand Down

0 comments on commit bfda96a

Please sign in to comment.