diff --git a/SABnzbd.py b/SABnzbd.py index e3b9dd8..b6a17e5 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -1291,29 +1291,16 @@ def main(): else: logging.debug('Could not determine my IPv6 address') - - # measure and log Pystone performance - # to avoid a triple nested try/except construction, we use another method: - for pystonemodule in ['test.pystone', 'sabnzbd.utils.pystone']: - try: - exec "from " + pystonemodule + " import pystones" - logging.debug('CPU Pystone available performance is %s',int(pystones(1000)[1])) - break # import and calculation worked, so we're done. Get out of the for loop - except: - pass # ... the import went wrong, so continue in the for loop + # Measure and log system performance measured by pystone and - if possible - CPU model + from sabnzbd.utils.getperformance import getpystone, getcpu + pystoneperf = getpystone() + if pystoneperf: + logging.debug('CPU Pystone available performance is %s', pystoneperf) else: - # got to the end of the for (!) loop, so no more pystone modules to try ... - logging.debug("Could not import or calculate pystones") - - # On Linux, let's print the CPU model name: - try: - for myline in open("/proc/cpuinfo"): - if myline.startswith(('model name')): - logging.debug('CPU model name is %s', myline[13:].rstrip() ) - break - except: - # probably not on Linux - pass + logging.debug('CPU Pystone available performance could not be calculated') + cpumodel = getcpu() # Linux only + if cpumodel: + logging.debug('CPU model name is %s', cpumodel) # OSX 10.5 I/O priority setting if sabnzbd.DARWIN: diff --git a/interfaces/Plush/templates/status.tmpl b/interfaces/Plush/templates/status.tmpl index 41b1b63..4ccda85 100644 --- a/interfaces/Plush/templates/status.tmpl +++ b/interfaces/Plush/templates/status.tmpl @@ -125,28 +125,71 @@
- + + + + + "> + + + + "> + + "> - + + "> - + + "> - + "> - + + "> "> - + + "> "> - + "> + +
Item Value
Item Value
Local IPv4 address + $localipv4 + No local IPv4. That is bad + +
Public IPv4 address + $publicipv4 + No public IPv4. That is bad + +
Local IPv4 address$localipv4
IPv6 address + $ipv6 + No IPv6. + +
Public IPv4 address$publicipv4
Nameserver / DNS Lookup + DNS is OK + + No DNS + First fix your network, then check DNS again + + +
IPv6 address$ipv6
System Performance (Pystone)$pystone
Nameserver / DNS Lookup$dnslookup
CPU Model (only on Linux)$cpumodel
Download Directory$downloaddir
Download Directory Speed [MB/s]$downloaddirspeed
Download Directory writing Speed [MB/s] + $downloaddirspeed + Could not write. That is bad + +
Complete Directory$completedir
Complete Directory Speed [MB/s]$completedirspeed
Complete Directory writing Speed [MB/s] + $completedirspeed + Could not write. That is bad + +
Dash Refresh Counter$dashrefreshcounter

If you want to (re)run the tests, click on: diff --git a/sabnzbd/interface.py b/sabnzbd/interface.py index feca435..b2161b8 100644 --- a/sabnzbd/interface.py +++ b/sabnzbd/interface.py @@ -2291,27 +2291,31 @@ class Status(object): header['folders'] = sabnzbd.nzbqueue.scan_jobs(all=False, action=False) header['configfn'] = config.get_filename() - # For the Dashboard: + # Dashboard: Begin from utils.getipaddress import localipv4, publicipv4, ipv6 header['localipv4'] = localipv4() header['publicipv4'] = publicipv4() header['ipv6'] = ipv6() - # DNS-check + # Dashboard: DNS-check try: import socket socket.gethostbyname('www.google.com') header['dnslookup'] = "OK" except: - header['dnslookup'] = "Not OK" + header['dnslookup'] = None - # Speed of Download directory: + # Dashboard: Speed of System + from sabnzbd.utils.getperformance import getpystone, getcpu + header['pystone'] = getpystone() + header['cpumodel'] = getcpu() + # Dashboard: Speed of Download directory: header['downloaddir'] = sabnzbd.cfg.download_dir.get_path() try: sabnzbd.downloaddirspeed # The persistent var except: sabnzbd.downloaddirspeed = None header['downloaddirspeed'] = sabnzbd.downloaddirspeed - # Speed of Complete directory: + # Dashboard: Speed of Complete directory: header['completedir'] = sabnzbd.cfg.complete_dir.get_path() try: sabnzbd.completedirspeed # The persistent var @@ -2324,6 +2328,7 @@ class Status(object): except: sabnzbd.dashrefreshcounter = 0 header['dashrefreshcounter'] = sabnzbd.dashrefreshcounter + # Dashboard: End header['servers'] = [] diff --git a/sabnzbd/utils/getperformance.py b/sabnzbd/utils/getperformance.py new file mode 100644 index 0000000..66855d9 --- /dev/null +++ b/sabnzbd/utils/getperformance.py @@ -0,0 +1,31 @@ +def getcpu(): + # On Linux, let's get the CPU model name: + cputype = None + try: + for myline in open("/proc/cpuinfo"): + if myline.startswith(('model name')): + cputype = myline[13:].rstrip() + break + except: + # probably not on Linux + pass + return cputype + + +def getpystone(): + value = None + for pystonemodule in ['test.pystone', 'pystone']: + try: + exec "from " + pystonemodule + " import pystones" + value = int(pystones(1000)[1]) + break # import and calculation worked, so we're done. Get out of the for loop + except: + pass # ... the import went wrong, so continue in the for loop + return value + + + +if __name__ == '__main__': + print getpystone() + print getcpu() +