Update screen shot

pull/2721/head
nicolargo 2024-04-07 17:46:05 +02:00
parent 82d7bfa875
commit 7e7d4d1a97
4 changed files with 25 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 349 KiB

After

Width:  |  Height:  |  Size: 425 KiB

View File

@ -17,7 +17,7 @@ import psutil
fields_description = { fields_description = {
'phys': {'description': 'Number of physical cores (hyper thread CPUs are excluded).', 'unit': 'number'}, 'phys': {'description': 'Number of physical cores (hyper thread CPUs are excluded).', 'unit': 'number'},
'log': { 'log': {
'description': 'Number of logical CPUs. A logical CPU is the number of \ 'description': 'Number of logical CPU cores. A logical CPU is the number of \
physical cores multiplied by the number of threads that can run on each core.', physical cores multiplied by the number of threads that can run on each core.',
'unit': 'number', 'unit': 'number',
}, },

View File

@ -60,12 +60,17 @@ items_history_list = [
# Get the number of logical CPU core only once # Get the number of logical CPU core only once
# the variable is also shared with the QuickLook plugin # the variable is also shared with the QuickLook plugin
nb_log_core = 1
nb_phys_core = 1
try: try:
nb_log_core = CorePluginModel().update()["log"] core = CorePluginModel().update()
except Exception as e: except Exception as e:
logger.warning('Error: Can not retrieve the CPU core number (set it to 1) ({})'.format(e)) logger.warning('Error: Can not retrieve the CPU core number (set it to 1) ({})'.format(e))
nb_log_core = 1 else:
if 'log' in core:
nb_log_core = core['log']
if 'phys' in core:
nb_phys_core = core['phys']
class PluginModel(GlancesPluginModel): class PluginModel(GlancesPluginModel):
"""Glances load plugin. """Glances load plugin.
@ -183,6 +188,11 @@ def get_nb_log_core():
return nb_log_core return nb_log_core
def get_nb_phys_core():
"""Get the number of physical CPU core."""
return nb_phys_core
def get_load_average(percent: bool = False): def get_load_average(percent: bool = False):
"""Get load average. On both Linux and Windows thanks to PsUtil """Get load average. On both Linux and Windows thanks to PsUtil

View File

@ -11,7 +11,7 @@
from glances.logger import logger from glances.logger import logger
from glances.cpu_percent import cpu_percent from glances.cpu_percent import cpu_percent
from glances.plugins.load import get_load_average, get_nb_log_core from glances.plugins.load import get_load_average, get_nb_log_core, get_nb_phys_core
from glances.outputs.glances_bars import Bar from glances.outputs.glances_bars import Bar
from glances.outputs.glances_sparklines import Sparkline from glances.outputs.glances_sparklines import Sparkline
from glances.plugins.plugin.model import GlancesPluginModel from glances.plugins.plugin.model import GlancesPluginModel
@ -41,6 +41,14 @@ fields_description = {
'description': 'LOAD percent usage', 'description': 'LOAD percent usage',
'unit': 'percent', 'unit': 'percent',
}, },
'cpu_log_core': {
'description': 'Number of logical CPU core',
'unit': 'number',
},
'cpu_phys_core': {
'description': 'Number of physical CPU core',
'unit': 'number',
},
'cpu_name': { 'cpu_name': {
'description': 'CPU name', 'description': 'CPU name',
}, },
@ -121,7 +129,8 @@ class PluginModel(GlancesPluginModel):
stats['swap'] = None stats['swap'] = None
# Get load # Get load
stats['cpucore'] = get_nb_log_core() stats['cpu_log_core'] = get_nb_log_core()
stats['cpu_phys_core'] = get_nb_phys_core()
try: try:
# Load average is a tuple (1 min, 5 min, 15 min) # Load average is a tuple (1 min, 5 min, 15 min)
# Process only the 15 min value (index 2) # Process only the 15 min value (index 2)