projects
/
quix0rs-apt-p2p.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
146f104
)
Add bytes/sec to the DHT stats.
author
Cameron Dale
<camrdale@gmail.com>
Mon, 17 Mar 2008 21:07:59 +0000
(14:07 -0700)
committer
Cameron Dale
<camrdale@gmail.com>
Mon, 17 Mar 2008 21:07:59 +0000
(14:07 -0700)
apt_p2p_Khashmir/stats.py
patch
|
blob
|
history
diff --git
a/apt_p2p_Khashmir/stats.py
b/apt_p2p_Khashmir/stats.py
index aeb979efea6cbbeb3d375cc21ff5de587ece23c6..d1d5ff180110f17cd73ede2659a9ddb1ff7b5b60 100644
(file)
--- a/
apt_p2p_Khashmir/stats.py
+++ b/
apt_p2p_Khashmir/stats.py
@@
-92,6
+92,18
@@
class StatsLogger:
'tip': 'The number of bytes sent by the DHT',
'value': None,
},
'tip': 'The number of bytes sent by the DHT',
'value': None,
},
+ {'name': 'downSpeed',
+ 'group': 'Transport',
+ 'desc': 'Downloaded bytes/second',
+ 'tip': 'The number of bytes received by the DHT per second',
+ 'value': None,
+ },
+ {'name': 'upSpeed',
+ 'group': 'Transport',
+ 'desc': 'Uploaded bytes/second',
+ 'tip': 'The number of bytes sent by the DHT per second',
+ 'value': None,
+ },
{'name': 'actions',
'group': 'Actions',
'desc': 'Actions',
{'name': 'actions',
'group': 'Actions',
'desc': 'Actions',
@@
-168,12
+180,17
@@
class StatsLogger:
self.tableStats()
self.dbStats()
stats = self._StatsTemplate[:]
self.tableStats()
self.dbStats()
stats = self._StatsTemplate[:]
+ elapsed = datetime.now() - self.startTime
for stat in stats:
val = getattr(self, stat['name'], None)
if stat['name'] == 'uptime':
for stat in stats:
val = getattr(self, stat['name'], None)
if stat['name'] == 'uptime':
- stat['value'] =
datetime.now() - self.startTime
+ stat['value'] =
elapsed
elif stat['name'] == 'actions':
stat['value'] = deepcopy(self.actions)
elif stat['name'] == 'actions':
stat['value'] = deepcopy(self.actions)
+ elif stat['name'] == 'downSpeed':
+ stat['value'] = self.downBytes / (elapsed.days*86400.0 + elapsed.seconds + elapsed.microseconds/1000000.0)
+ elif stat['name'] == 'upSpeed':
+ stat['value'] = self.upBytes / (elapsed.days*86400.0 + elapsed.seconds + elapsed.microseconds/1000000.0)
elif val is not None:
stat['value'] = val
elif val is not None:
stat['value'] = val