[Qt] simple mempool info in debug window
This commit is contained in:
parent
6176e9bf3d
commit
c197798d1b
5 changed files with 142 additions and 50 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include "checkpoints.h"
|
#include "checkpoints.h"
|
||||||
#include "clientversion.h"
|
#include "clientversion.h"
|
||||||
#include "net.h"
|
#include "net.h"
|
||||||
|
#include "txmempool.h"
|
||||||
#include "ui_interface.h"
|
#include "ui_interface.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
@ -88,6 +89,16 @@ QDateTime ClientModel::getLastBlockDate() const
|
||||||
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
|
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long ClientModel::getMempoolSize() const
|
||||||
|
{
|
||||||
|
return mempool.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t ClientModel::getMempoolDynamicUsage() const
|
||||||
|
{
|
||||||
|
return mempool.DynamicMemoryUsage();
|
||||||
|
}
|
||||||
|
|
||||||
double ClientModel::getVerificationProgress() const
|
double ClientModel::getVerificationProgress() const
|
||||||
{
|
{
|
||||||
LOCK(cs_main);
|
LOCK(cs_main);
|
||||||
|
@ -122,6 +133,7 @@ void ClientModel::updateTimer()
|
||||||
Q_EMIT numBlocksChanged(newNumBlocks, newBlockDate);
|
Q_EMIT numBlocksChanged(newNumBlocks, newBlockDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Q_EMIT mempoolSizeChanged(getMempoolSize(), getMempoolDynamicUsage());
|
||||||
Q_EMIT bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
|
Q_EMIT bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,11 @@ public:
|
||||||
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
|
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
|
||||||
int getNumBlocks() const;
|
int getNumBlocks() const;
|
||||||
|
|
||||||
|
//! Return number of transactions in the mempool
|
||||||
|
long getMempoolSize() const;
|
||||||
|
//! Return the dynamic memory usage of the mempool
|
||||||
|
size_t getMempoolDynamicUsage() const;
|
||||||
|
|
||||||
quint64 getTotalBytesRecv() const;
|
quint64 getTotalBytesRecv() const;
|
||||||
quint64 getTotalBytesSent() const;
|
quint64 getTotalBytesSent() const;
|
||||||
|
|
||||||
|
@ -89,6 +94,7 @@ private:
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void numConnectionsChanged(int count);
|
void numConnectionsChanged(int count);
|
||||||
void numBlocksChanged(int count, const QDateTime& blockDate);
|
void numBlocksChanged(int count, const QDateTime& blockDate);
|
||||||
|
void mempoolSizeChanged(long count, size_t mempoolSizeInBytes);
|
||||||
void alertsChanged(const QString &warnings);
|
void alertsChanged(const QString &warnings);
|
||||||
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
|
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
<string>&Information</string>
|
<string>&Information</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
|
||||||
<property name="horizontalSpacing">
|
<property name="horizontalSpacing">
|
||||||
<number>12</number>
|
<number>12</number>
|
||||||
</property>
|
</property>
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="clientName">
|
<widget class="QLabel" name="clientName">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
<item row="2" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="clientVersion">
|
<widget class="QLabel" name="clientVersion">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -96,7 +96,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="3" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="clientUserAgent">
|
<widget class="QLabel" name="clientUserAgent">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="1">
|
<item row="4" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="openSSLVersion">
|
<widget class="QLabel" name="openSSLVersion">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -148,7 +148,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="berkeleyDBVersion">
|
<widget class="QLabel" name="berkeleyDBVersion">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -171,7 +171,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="1">
|
<item row="6" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="buildDate">
|
<widget class="QLabel" name="buildDate">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="7" column="1">
|
<item row="7" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="startupTime">
|
<widget class="QLabel" name="startupTime">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -210,19 +210,6 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="label_11">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Network</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0">
|
<item row="9" column="0">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -230,7 +217,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="9" column="1">
|
<item row="9" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="networkName">
|
<widget class="QLabel" name="networkName">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -253,7 +240,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="10" column="1">
|
<item row="10" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="numberOfConnections">
|
<widget class="QLabel" name="numberOfConnections">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -289,7 +276,7 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="12" column="1">
|
<item row="12" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="numberOfBlocks">
|
<widget class="QLabel" name="numberOfBlocks">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -306,13 +293,13 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="0">
|
<item row="13" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="labelLastBlockTime">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Last block time</string>
|
<string>Last block time</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="13" column="1">
|
<item row="13" column="1" colspan="2">
|
||||||
<widget class="QLabel" name="lastBlockTime">
|
<widget class="QLabel" name="lastBlockTime">
|
||||||
<property name="cursor">
|
<property name="cursor">
|
||||||
<cursorShape>IBeamCursor</cursorShape>
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
@ -329,20 +316,7 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="14" column="0">
|
<item row="14" column="0">
|
||||||
<spacer name="verticalSpacer_2">
|
<widget class="QLabel" name="labelMempoolTitle">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item row="15" column="0">
|
|
||||||
<widget class="QLabel" name="labelDebugLogfile">
|
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<weight>75</weight>
|
<weight>75</weight>
|
||||||
|
@ -350,11 +324,95 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Debug log file</string>
|
<string>Memory Pool</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="15" column="0">
|
||||||
|
<widget class="QLabel" name="labelNumberOfTransactions">
|
||||||
|
<property name="text">
|
||||||
|
<string>Current number of transactions</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="15" column="1">
|
||||||
|
<widget class="QLabel" name="mempoolNumberTxs">
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>N/A</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="labelNetwork">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Network</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="16" column="0">
|
<item row="16" column="0">
|
||||||
|
<widget class="QLabel" name="labelMemoryUsage">
|
||||||
|
<property name="text">
|
||||||
|
<string>Memory usage</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="16" column="1">
|
||||||
|
<widget class="QLabel" name="mempoolSize">
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>N/A</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="14" column="2" rowspan="3">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayoutDebugButton">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>10</width>
|
||||||
|
<height>5</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="labelDebugLogfile">
|
||||||
|
<property name="text">
|
||||||
|
<string>Debug log file</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
<widget class="QPushButton" name="openDebugLogfileButton">
|
<widget class="QPushButton" name="openDebugLogfileButton">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Open the Bitcoin Core debug log file from the current data directory. This can take a few seconds for large log files.</string>
|
<string>Open the Bitcoin Core debug log file from the current data directory. This can take a few seconds for large log files.</string>
|
||||||
|
@ -367,7 +425,9 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="17" column="0">
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="18" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
|
|
@ -343,6 +343,8 @@ void RPCConsole::setClientModel(ClientModel *model)
|
||||||
updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
|
updateTrafficStats(model->getTotalBytesRecv(), model->getTotalBytesSent());
|
||||||
connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));
|
connect(model, SIGNAL(bytesChanged(quint64,quint64)), this, SLOT(updateTrafficStats(quint64, quint64)));
|
||||||
|
|
||||||
|
connect(model, SIGNAL(mempoolSizeChanged(long,size_t)), this, SLOT(setMempoolSize(long,size_t)));
|
||||||
|
|
||||||
// set up peer table
|
// set up peer table
|
||||||
ui->peerWidget->setModel(model->getPeerTableModel());
|
ui->peerWidget->setModel(model->getPeerTableModel());
|
||||||
ui->peerWidget->verticalHeader()->hide();
|
ui->peerWidget->verticalHeader()->hide();
|
||||||
|
@ -523,6 +525,16 @@ void RPCConsole::setNumBlocks(int count, const QDateTime& blockDate)
|
||||||
ui->lastBlockTime->setText(blockDate.toString());
|
ui->lastBlockTime->setText(blockDate.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RPCConsole::setMempoolSize(long numberOfTxs, size_t dynUsage)
|
||||||
|
{
|
||||||
|
ui->mempoolNumberTxs->setText(QString::number(numberOfTxs));
|
||||||
|
|
||||||
|
if (dynUsage < 1000000)
|
||||||
|
ui->mempoolSize->setText(QString::number(dynUsage/1000.0, 'f', 2) + " KB");
|
||||||
|
else
|
||||||
|
ui->mempoolSize->setText(QString::number(dynUsage/1000000.0, 'f', 2) + " MB");
|
||||||
|
}
|
||||||
|
|
||||||
void RPCConsole::on_lineEdit_returnPressed()
|
void RPCConsole::on_lineEdit_returnPressed()
|
||||||
{
|
{
|
||||||
QString cmd = ui->lineEdit->text();
|
QString cmd = ui->lineEdit->text();
|
||||||
|
|
|
@ -77,6 +77,8 @@ public Q_SLOTS:
|
||||||
void setNumConnections(int count);
|
void setNumConnections(int count);
|
||||||
/** Set number of blocks and last block date shown in the UI */
|
/** Set number of blocks and last block date shown in the UI */
|
||||||
void setNumBlocks(int count, const QDateTime& blockDate);
|
void setNumBlocks(int count, const QDateTime& blockDate);
|
||||||
|
/** Set size (number of transactions and memory usage) of the mempool in the UI */
|
||||||
|
void setMempoolSize(long numberOfTxs, size_t dynUsage);
|
||||||
/** Go forward or back in history */
|
/** Go forward or back in history */
|
||||||
void browseHistory(int offset);
|
void browseHistory(int offset);
|
||||||
/** Scroll console view to end */
|
/** Scroll console view to end */
|
||||||
|
|
Loading…
Reference in a new issue