Show inventory lookup rate on Network Status tab
This commit is contained in:
parent
3ca4578f7f
commit
6159d5e622
|
@ -118,6 +118,10 @@ class MyForm(QtGui.QMainWindow):
|
|||
|
||||
self.ui.labelSendBroadcastWarning.setVisible(False)
|
||||
|
||||
self.timer = QtCore.QTimer()
|
||||
self.timer.start(2000) # milliseconds
|
||||
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
|
||||
|
||||
# FILE MENU and other buttons
|
||||
QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL(
|
||||
"triggered()"), self.quit)
|
||||
|
@ -1292,6 +1296,12 @@ class MyForm(QtGui.QMainWindow):
|
|||
elif len(shared.connectedHostsList) == 0:
|
||||
self.setStatusIcon('red')
|
||||
|
||||
# timer driven
|
||||
def runEveryTwoSeconds(self):
|
||||
self.ui.labelLookupsPerSecond.setText(_translate(
|
||||
"MainWindow", "Inventory lookups per second: %1").arg(str(shared.numberOfInventoryLookupsPerformed/2)))
|
||||
shared.numberOfInventoryLookupsPerformed = 0
|
||||
|
||||
# Indicates whether or not there is a connection to the Bitmessage network
|
||||
connected = False
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
# Form implementation generated from reading ui file 'bitmessageui.ui'
|
||||
#
|
||||
# Created: Thu Aug 15 14:19:52 2013
|
||||
# by: PyQt4 UI code generator 4.10
|
||||
# Created: Tue Sep 03 15:17:26 2013
|
||||
# by: PyQt4 UI code generator 4.10.2
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
|
@ -430,13 +430,16 @@ class Ui_MainWindow(object):
|
|||
self.labelBroadcastCount = QtGui.QLabel(self.networkstatus)
|
||||
self.labelBroadcastCount.setGeometry(QtCore.QRect(350, 150, 351, 16))
|
||||
self.labelBroadcastCount.setObjectName(_fromUtf8("labelBroadcastCount"))
|
||||
self.labelLookupsPerSecond = QtGui.QLabel(self.networkstatus)
|
||||
self.labelLookupsPerSecond.setGeometry(QtCore.QRect(320, 210, 291, 16))
|
||||
self.labelLookupsPerSecond.setObjectName(_fromUtf8("labelLookupsPerSecond"))
|
||||
icon9 = QtGui.QIcon()
|
||||
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/networkstatus.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||
self.tabWidget.addTab(self.networkstatus, icon9, _fromUtf8(""))
|
||||
self.gridLayout.addWidget(self.tabWidget, 0, 0, 1, 1)
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtGui.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 23))
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 795, 18))
|
||||
self.menubar.setObjectName(_fromUtf8("menubar"))
|
||||
self.menuFile = QtGui.QMenu(self.menubar)
|
||||
self.menuFile.setObjectName(_fromUtf8("menuFile"))
|
||||
|
@ -554,8 +557,8 @@ class Ui_MainWindow(object):
|
|||
self.textEditMessage.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>", None))
|
||||
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>", None))
|
||||
self.label.setText(_translate("MainWindow", "To:", None))
|
||||
self.label_2.setText(_translate("MainWindow", "From:", None))
|
||||
self.radioButtonBroadcast.setText(_translate("MainWindow", "Broadcast to everyone who is subscribed to your address", None))
|
||||
|
@ -621,6 +624,7 @@ class Ui_MainWindow(object):
|
|||
self.labelMessageCount.setText(_translate("MainWindow", "Processed 0 person-to-person message.", None))
|
||||
self.labelPubkeyCount.setText(_translate("MainWindow", "Processed 0 public key.", None))
|
||||
self.labelBroadcastCount.setText(_translate("MainWindow", "Processed 0 broadcast.", None))
|
||||
self.labelLookupsPerSecond.setText(_translate("MainWindow", "Inventory lookups per second: 0", None))
|
||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status", None))
|
||||
self.menuFile.setTitle(_translate("MainWindow", "File", None))
|
||||
self.menuSettings.setTitle(_translate("MainWindow", "Settings", None))
|
||||
|
|
|
@ -22,16 +22,7 @@
|
|||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
|
@ -287,8 +278,8 @@
|
|||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Sans'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2';"><br /></p></body></html></string>
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1040,6 +1031,19 @@ p, li { white-space: pre-wrap; }
|
|||
<string>Processed 0 broadcast.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="labelLookupsPerSecond">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>320</x>
|
||||
<y>210</y>
|
||||
<width>291</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Inventory lookups per second: 0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1051,7 +1055,7 @@ p, li { white-space: pre-wrap; }
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>795</width>
|
||||
<height>23</height>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuFile">
|
||||
|
|
|
@ -173,6 +173,7 @@ class receiveDataThread(threading.Thread):
|
|||
self.payloadLength + 24:] # take this message out and then process the next message
|
||||
if self.data == '':
|
||||
while len(self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave) > 0:
|
||||
shared.numberOfInventoryLookupsPerformed += 1
|
||||
random.seed()
|
||||
objectHash, = random.sample(
|
||||
self.objectsThatWeHaveYetToCheckAndSeeWhetherWeAlreadyHave, 1)
|
||||
|
@ -375,6 +376,7 @@ class receiveDataThread(threading.Thread):
|
|||
print 'The stream number encoded in this broadcast message (' + str(streamNumber) + ') does not match the stream number on which it was received. Ignoring it.'
|
||||
return
|
||||
|
||||
shared.numberOfInventoryLookupsPerformed += 1
|
||||
shared.inventoryLock.acquire()
|
||||
self.inventoryHash = calculateInventoryHash(data)
|
||||
if self.inventoryHash in shared.inventory:
|
||||
|
@ -738,6 +740,7 @@ class receiveDataThread(threading.Thread):
|
|||
return
|
||||
readPosition += streamNumberAsClaimedByMsgLength
|
||||
self.inventoryHash = calculateInventoryHash(data)
|
||||
shared.numberOfInventoryLookupsPerformed += 1
|
||||
shared.inventoryLock.acquire()
|
||||
if self.inventoryHash in shared.inventory:
|
||||
print 'We have already received this msg message. Ignoring.'
|
||||
|
@ -1135,6 +1138,7 @@ class receiveDataThread(threading.Thread):
|
|||
print 'stream number embedded in this pubkey doesn\'t match our stream number. Ignoring.'
|
||||
return
|
||||
|
||||
shared.numberOfInventoryLookupsPerformed += 1
|
||||
inventoryHash = calculateInventoryHash(data)
|
||||
shared.inventoryLock.acquire()
|
||||
if inventoryHash in shared.inventory:
|
||||
|
@ -1328,6 +1332,7 @@ class receiveDataThread(threading.Thread):
|
|||
return
|
||||
readPosition += streamNumberLength
|
||||
|
||||
shared.numberOfInventoryLookupsPerformed += 1
|
||||
inventoryHash = calculateInventoryHash(data)
|
||||
shared.inventoryLock.acquire()
|
||||
if inventoryHash in shared.inventory:
|
||||
|
@ -1423,6 +1428,7 @@ class receiveDataThread(threading.Thread):
|
|||
return
|
||||
self.someObjectsOfWhichThisRemoteNodeIsAlreadyAware[
|
||||
data[lengthOfVarint:32 + lengthOfVarint]] = 0
|
||||
shared.numberOfInventoryLookupsPerformed += 1
|
||||
if data[lengthOfVarint:32 + lengthOfVarint] in shared.inventory:
|
||||
with shared.printLock:
|
||||
print 'Inventory (in memory) has inventory item already.'
|
||||
|
@ -1480,7 +1486,7 @@ class receiveDataThread(threading.Thread):
|
|||
with shared.printLock:
|
||||
print 'received getdata request for item:', hash.encode('hex')
|
||||
|
||||
# print 'inventory is', shared.inventory
|
||||
shared.numberOfInventoryLookupsPerformed += 1
|
||||
if hash in shared.inventory:
|
||||
objectType, streamNumber, payload, receivedTime = shared.inventory[
|
||||
hash]
|
||||
|
|
|
@ -66,6 +66,7 @@ clientHasReceivedIncomingConnections = False #used by API command clientStatus
|
|||
numberOfMessagesProcessed = 0
|
||||
numberOfBroadcastsProcessed = 0
|
||||
numberOfPubkeysProcessed = 0
|
||||
numberOfInventoryLookupsPerformed = 0
|
||||
|
||||
#If changed, these values will cause particularly unexpected behavior: You won't be able to either send or receive messages because the proof of work you do (or demand) won't match that done or demanded by others. Don't change them!
|
||||
networkDefaultProofOfWorkNonceTrialsPerByte = 320 #The amount of work that should be performed (and demanded) per byte of the payload. Double this number to double the work.
|
||||
|
|
Reference in New Issue
Block a user