# HG changeset patch # User Marcin Kuzminski # Date 2017-02-23 19:27:20 # Node ID 183c28da1933847e893e9f1a7ddf2321fd70b017 # Parent 1f27d629aa799e09d6f92ab76c561c2df9ba1d8e system-info: added more details about CPU. diff --git a/rhodecode/admin/views/system_info.py b/rhodecode/admin/views/system_info.py --- a/rhodecode/admin/views/system_info.py +++ b/rhodecode/admin/views/system_info.py @@ -124,7 +124,7 @@ class AdminSystemInfoSettingsView(AdminS ('', '', ''), # spacer # Systems stats - (_('CPU'), val('cpu'), state('cpu')), + (_('CPU'), val('cpu')['text'], state('cpu')), (_('Load'), val('load')['text'], state('load')), (_('Memory'), val('memory')['text'], state('memory')), (_('Uptime'), val('uptime')['text'], state('uptime')), diff --git a/rhodecode/lib/system_info.py b/rhodecode/lib/system_info.py --- a/rhodecode/lib/system_info.py +++ b/rhodecode/lib/system_info.py @@ -206,14 +206,20 @@ def machine_load(): def cpu(): - value = 0 + value = {'cpu': 0, 'cpu_count': 0, 'cpu_usage': []} state = STATE_OK_DEFAULT if not psutil: return SysInfoRes(value=value, state=state) - value = psutil.cpu_percent(0.5) - human_value = '{} %'.format(value) + value['cpu'] = psutil.cpu_percent(0.5) + value['cpu_usage'] = psutil.cpu_percent(0.5, percpu=True) + value['cpu_count'] = psutil.cpu_count() + + human_value = value.copy() + human_value['text'] = '{} cores at {} %'.format( + value['cpu_count'], value['cpu']) + return SysInfoRes(value=value, state=state, human_value=human_value)