Skip to content

Commit 1d71ea5

Browse files
committed
Enhance process diagram functionality and update resources
- Updated Get-AbrProcessDiagram.ps1 to include CPU and memory usage for the top 5 CPU-consuming processes. - Modified the SubGraph to improve node representation and added additional information for each process. - Incremented version number in Get-AbrProcessInfo.ps1 from 0.1.1 to 0.1.2. - Added a new resource entry for process icons in Invoke-AsBuiltReport.System.Resources.ps1. - Introduced a new icon file Process.png for process representation.
1 parent f7574fd commit 1d71ea5

6 files changed

Lines changed: 65 additions & 61 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222
- Diagrammer.Core minimum version increased to 0.2.38
2323
- AsBuiltReport.Chart minimum version increased to 0.2.0
2424

25+
### Fixed
26+
27+
- Fix process name display in Process section and diagram by removing extra information from the process name.
28+
2529
## [0.1.1] - 2025-10-11
2630

2731
### Added

Samples/System Resources As Built Report.html

Lines changed: 54 additions & 54 deletions
Large diffs are not rendered by default.

Src/Private/Get-AbrProcessDiagram.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ function Get-AbrProcessDiagram {
5050

5151
process {
5252
try {
53-
$Process = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -Property @{Name = 'Name'; Expression = { "$($_.Name.Split(' ')[0]) (Id=$($_.Id))" } } -First 5
54-
SubGraph ProcessH -Attributes @{Label = $($reportTranslate.Label); fontsize = 22; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded'; color = 'gray' } {
55-
Node 'System' -NodeScript { $_ } -Attributes @{shape = 'rectangle'; style = 'filled'; fillcolor = '#EDEDED'; color = '#71797E'; fontcolor = $Fontcolor; penwidth = 1.5; }
56-
Node $Process.Name -NodeScript { $_ } -Attributes @{shape = 'rectangle'; style = 'filled'; fillcolor = '#EDEDED'; color = '#71797E'; fontcolor = $Fontcolor; penwidth = 1.5; }
57-
Edge -From 'System' -To $Process.Name -Attributes @{color = $Edgecolor; style = 'dashed'; penwidth = 1.5; }
53+
$Process = Get-Process | Sort-Object -Property CPU -Descending | Select-Object -Property @{Name = 'Name'; Expression = { "$($_.Name.Split(' ')[0]) (Id=$($_.Id))" } }, @{Name = 'CPU'; Expression = { try { [math]::Round($_.CPU, 0) } catch { '--' } } }, @{Name = 'MEM'; Expression = { try { [math]::Round($_.WorkingSet / 1MB, 0) } catch { '--' } } } -First 5
54+
SubGraph ProcessH -Attributes @{Label = $($reportTranslate.Label); fontsize = 28; fontcolor = $Fontcolor; penwidth = 1.5; labelloc = 't'; style = 'dashed,rounded'; color = 'gray' } {
5855

56+
Add-DiaNodeIcon -Name 'System' -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject
57+
$Process | ForEach-Object { Add-DiaNodeIcon -Name $_.Name -IconDebug $IconDebug -IconType 'Process' -ImagesObj $Images -NodeObject -AditionalInfo @{'CPU Usage' = $_.CPU; 'Memory Usage' = $_.MEM} }
58+
Edge -From 'System' -To $Process.Name -Attributes @{color = $Edgecolor; style = 'dashed'; penwidth = 1.5; }
5959
}
6060

6161
} catch {

Src/Private/Get-AbrProcessInfo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Get-AbrProcessInfo {
66
.DESCRIPTION
77
88
.NOTES
9-
Version: 0.1.1
9+
Version: 0.1.2
1010
Author: AsBuiltReport Community
1111
Twitter: @AsBuiltReport
1212
Github: AsBuiltReport

Src/Public/Invoke-AsBuiltReport.System.Resources.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ function Invoke-AsBuiltReport.System.Resources {
4141
'AsBuiltReport_LOGO' = 'AsBuiltReport_Logo.png'
4242
'AsBuiltReport_Signature' = 'AsBuiltReport_Signature.png'
4343
'Abr_LOGO_Footer' = 'AsBuiltReport.png'
44+
'Process' = 'Process.png'
4445
}
4546

4647
#region foreach loop
@@ -52,7 +53,6 @@ function Invoke-AsBuiltReport.System.Resources {
5253
Get-AbrPSHost
5354
Get-AbrProcessInfo
5455
}
55-
5656
}
5757
#endregion foreach loop
5858
}

icons/Process.png

12.7 KB
Loading

0 commit comments

Comments
 (0)