add processor metric

This commit is contained in:
harisreedhar
2026-02-10 19:12:13 +05:30
committed by henryruhs
parent fa82d87302
commit 0bc6a545bf
3 changed files with 60 additions and 3 deletions
+26 -2
View File
@@ -6,7 +6,7 @@ import psutil
from facefusion import state_manager
from facefusion.execution import detect_execution_devices
from facefusion.types import DiskMetrics, MemoryMetrics, Metrics, NetworkMetrics
from facefusion.types import DiskMetrics, MemoryMetrics, Metrics, NetworkMetrics, ProcessorMetrics
def get_metrics_set() -> Metrics:
@@ -17,7 +17,8 @@ def get_metrics_set() -> Metrics:
'execution_devices': detect_execution_devices(),
'disks': detect_disk_metrics([ drive_path ]),
'memory': detect_memory_metrics(),
'network': detect_network_metrics()
'network': detect_network_metrics(),
'processor': detect_processor_metrics()
}
@@ -88,3 +89,26 @@ def detect_network_metrics() -> NetworkMetrics:
'unit': 'MB'
}
}
def detect_processor_metrics() -> ProcessorMetrics:
cpu_frequency = psutil.cpu_freq()
return\
{
'cores':
{
'value': psutil.cpu_count(logical = True),
'unit': 'cores'
},
'frequency':
{
'value': int(cpu_frequency.current),
'unit': 'MHz'
},
'utilization':
{
'value': int(psutil.cpu_percent(interval = None)),
'unit': '%'
}
}
+8 -1
View File
@@ -315,12 +315,19 @@ NetworkMetrics = TypedDict('NetworkMetrics',
'sent' : ValueAndUnit,
'received' : ValueAndUnit
})
ProcessorMetrics = TypedDict('ProcessorMetrics',
{
'cores' : ValueAndUnit,
'frequency' : ValueAndUnit,
'utilization' : ValueAndUnit
})
Metrics = TypedDict('Metrics',
{
'execution_devices' : List[ExecutionDevice],
'disks' : List[DiskMetrics],
'memory' : MemoryMetrics,
'network' : NetworkMetrics
'network' : NetworkMetrics,
'processor' : ProcessorMetrics
})
DownloadProvider = Literal['github', 'huggingface']