Skip to content

Commit e5cd798

Browse files
authored
Report MaxClockSpeed in CPU (lptstr#144)
* Report MaxClockSpeed in CPU * Round off to GHz
1 parent ca50dc9 commit e5cd798

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

winfetch.ps1

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,16 @@ function info_theme {
687687

688688
# ===== CPU/GPU =====
689689
function info_cpu {
690+
$cpu = Get-CimInstance -ClassName Win32_Processor -Property Name,MaxClockSpeed -CimSession $cimSession
691+
$cpuname = if ($cpu.Name.Contains('@')) {
692+
($cpu.Name -Split ' @ ')[0]
693+
} else {
694+
$cpu.Name
695+
}
696+
$cpufreq = [math]::round((([int]$cpu.MaxClockSpeed)/1000), 2)
690697
return @{
691698
title = "CPU"
692-
content = (Get-CimInstance -ClassName Win32_Processor -Property Name -CimSession $cimSession).Name
699+
content = "${cpuname} @ ${cpufreq}GHz"
693700
}
694701
}
695702

0 commit comments

Comments
 (0)