Skip to content

Commit f628d9a

Browse files
committed
Merge #8925: qt: Display minimum ping in debug window.
1724a40 Display minimum ping in debug window. (R E Broadley)
2 parents c71a654 + 1724a40 commit f628d9a

File tree

7 files changed

+34
-10
lines changed

7 files changed

+34
-10
lines changed

src/net.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ void CNode::copyStats(CNodeStats &stats)
659659

660660
// Raw ping time is in microseconds, but show it to user as whole seconds (Bitcoin users should be well used to small numbers with many decimal places by now :)
661661
stats.dPingTime = (((double)nPingUsecTime) / 1e6);
662-
stats.dPingMin = (((double)nMinPingUsecTime) / 1e6);
662+
stats.dMinPing = (((double)nMinPingUsecTime) / 1e6);
663663
stats.dPingWait = (((double)nPingUsecWait) / 1e6);
664664

665665
// Leave string empty if addrLocal invalid (not filled in yet)

src/net.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ class CNodeStats
503503
bool fWhitelisted;
504504
double dPingTime;
505505
double dPingWait;
506-
double dPingMin;
506+
double dMinPing;
507507
std::string addrLocal;
508508
CAddress addr;
509509
};

src/qt/forms/debugwindow.ui

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,13 +1353,36 @@
13531353
</widget>
13541354
</item>
13551355
<item row="16" column="0">
1356+
<widget class="QLabel" name="peerMinPingLabel">
1357+
<property name="text">
1358+
<string>Min Ping</string>
1359+
</property>
1360+
</widget>
1361+
</item>
1362+
<item row="16" column="2">
1363+
<widget class="QLabel" name="peerMinPing">
1364+
<property name="cursor">
1365+
<cursorShape>IBeamCursor</cursorShape>
1366+
</property>
1367+
<property name="text">
1368+
<string>N/A</string>
1369+
</property>
1370+
<property name="textFormat">
1371+
<enum>Qt::PlainText</enum>
1372+
</property>
1373+
<property name="textInteractionFlags">
1374+
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
1375+
</property>
1376+
</widget>
1377+
</item>
1378+
<item row="17" column="0">
13561379
<widget class="QLabel" name="label_timeoffset">
13571380
<property name="text">
13581381
<string>Time Offset</string>
13591382
</property>
13601383
</widget>
13611384
</item>
1362-
<item row="16" column="2">
1385+
<item row="17" column="2">
13631386
<widget class="QLabel" name="timeoffset">
13641387
<property name="cursor">
13651388
<cursorShape>IBeamCursor</cursorShape>
@@ -1375,7 +1398,7 @@
13751398
</property>
13761399
</widget>
13771400
</item>
1378-
<item row="17" column="1">
1401+
<item row="18" column="1">
13791402
<spacer name="verticalSpacer_3">
13801403
<property name="orientation">
13811404
<enum>Qt::Vertical</enum>

src/qt/guiutil.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -947,7 +947,7 @@ QString formatServicesStr(quint64 mask)
947947

948948
QString formatPingTime(double dPingTime)
949949
{
950-
return dPingTime == 0 ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10));
950+
return (dPingTime == std::numeric_limits<int64_t>::max()/1e6 || dPingTime == 0) ? QObject::tr("N/A") : QString(QObject::tr("%1 ms")).arg(QString::number((int)(dPingTime * 1000), 10));
951951
}
952952

953953
QString formatTimeOffset(int64_t nTimeOffset)

src/qt/peertablemodel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ bool NodeLessThan::operator()(const CNodeCombinedStats &left, const CNodeCombine
3131
case PeerTableModel::Subversion:
3232
return pLeft->cleanSubVer.compare(pRight->cleanSubVer) < 0;
3333
case PeerTableModel::Ping:
34-
return pLeft->dPingTime < pRight->dPingTime;
34+
return pLeft->dMinPing < pRight->dMinPing;
3535
}
3636

3737
return false;
@@ -113,7 +113,7 @@ PeerTableModel::PeerTableModel(ClientModel *parent) :
113113
clientModel(parent),
114114
timer(0)
115115
{
116-
columns << tr("NodeId") << tr("Node/Service") << tr("User Agent") << tr("Ping Time");
116+
columns << tr("NodeId") << tr("Node/Service") << tr("User Agent") << tr("Ping");
117117
priv = new PeerTablePriv();
118118
// default to unsorted
119119
priv->sortColumn = -1;
@@ -166,7 +166,7 @@ QVariant PeerTableModel::data(const QModelIndex &index, int role) const
166166
case Subversion:
167167
return QString::fromStdString(rec->nodeStats.cleanSubVer);
168168
case Ping:
169-
return GUIUtil::formatPingTime(rec->nodeStats.dPingTime);
169+
return GUIUtil::formatPingTime(rec->nodeStats.dMinPing);
170170
}
171171
} else if (role == Qt::TextAlignmentRole) {
172172
if (index.column() == Ping)

src/qt/rpcconsole.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ void RPCConsole::updateNodeDetail(const CNodeCombinedStats *stats)
895895
ui->peerConnTime->setText(GUIUtil::formatDurationStr(GetTime() - stats->nodeStats.nTimeConnected));
896896
ui->peerPingTime->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingTime));
897897
ui->peerPingWait->setText(GUIUtil::formatPingTime(stats->nodeStats.dPingWait));
898+
ui->peerMinPing->setText(GUIUtil::formatPingTime(stats->nodeStats.dMinPing));
898899
ui->timeoffset->setText(GUIUtil::formatTimeOffset(stats->nodeStats.nTimeOffset));
899900
ui->peerVersion->setText(QString("%1").arg(QString::number(stats->nodeStats.nVersion)));
900901
ui->peerSubversion->setText(QString::fromStdString(stats->nodeStats.cleanSubVer));

src/rpc/net.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ UniValue getpeerinfo(const UniValue& params, bool fHelp)
141141
obj.push_back(Pair("timeoffset", stats.nTimeOffset));
142142
if (stats.dPingTime > 0.0)
143143
obj.push_back(Pair("pingtime", stats.dPingTime));
144-
if (stats.dPingMin < std::numeric_limits<int64_t>::max()/1e6)
145-
obj.push_back(Pair("minping", stats.dPingMin));
144+
if (stats.dMinPing < std::numeric_limits<int64_t>::max()/1e6)
145+
obj.push_back(Pair("minping", stats.dMinPing));
146146
if (stats.dPingWait > 0.0)
147147
obj.push_back(Pair("pingwait", stats.dPingWait));
148148
obj.push_back(Pair("version", stats.nVersion));

0 commit comments

Comments
 (0)