Skip to content

Commit ff495f7

Browse files
committed
Refactor process name retrieval in Get-AbrProcessDiagram and Get-AbrProcessInfo functions to only include the first part of the name
1 parent 77e47b9 commit ff495f7

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

Src/Private/Get-AbrProcessDiagram.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ function Get-AbrProcessDiagram {
5050

5151
process {
5252
try {
53-
$Process = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -Property @{Name = 'Name'; Expression = { "$($_.Name) (Id=$($_.Id))" } } -First 5
53+
$Process = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -Property @{Name = 'Name'; Expression = { "$($_.Name.Split(' ')[0]) (Id=$($_.Id))" } } -First 5
5454
SubGraph ProcessH -Attributes @{Label = $($reportTranslate.Label); fontsize = 22; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded'; color = 'gray' } {
5555
Node 'System' -NodeScript { $_ } -Attributes @{shape = 'rectangle'; style = 'filled'; fillcolor = '#EDEDED'; color = '#71797E'; fontcolor = $Fontcolor; penwidth = 1.5; }
5656
Node $Process.Name -NodeScript { $_ } -Attributes @{shape = 'rectangle'; style = 'filled'; fillcolor = '#EDEDED'; color = '#71797E'; fontcolor = $Fontcolor; penwidth = 1.5; }

Src/Private/Get-AbrProcessInfo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function Get-AbrProcessInfo {
3434
$SystemProcessInfo = @()
3535
foreach ($Process in $SystemProcess) {
3636
$InObj = [Ordered]@{
37-
$($reportTranslate.Name) = $Process.ProcessName
37+
$($reportTranslate.Name) = $Process.ProcessName.Split(' ')[0]
3838
$($reportTranslate.Id) = $Process.Id
3939
$($reportTranslate.CPU) = & { try { [math]::Round($Process.CPU, 0) } catch { '--' } }
4040
$($reportTranslate.Memory) = & { try { [math]::Round($Process.WorkingSet / 1MB, 0) } catch { '--' } }

0 commit comments

Comments
 (0)