Skip to content

Commit 9040b67

Browse files
feat: Adding CPU Speed, adjusting CSS ( Fixes PoshWeb#1, Fixes PoshWeb#2, Fixes PoshWeb#3 )
1 parent 5e6d371 commit 9040b67

1 file changed

Lines changed: 26 additions & 3 deletions

File tree

build.ps1

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,28 @@ Push-Location $PSScriptRoot
1414
if ($env:GITHUB_WORKFLOW) {
1515
$null = sudo npm install -g '@11ty/eleventy'
1616
}
17-
1817
#endregion Install Prereqs
1918

19+
#region Get Clock Speed
20+
$cpuSpeed =
21+
if ($executionContext.SessionState.PSVariable.Get('IsLinux').Value) {
22+
Get-Content /proc/cpuinfo -Raw -ErrorAction SilentlyContinue |
23+
Select-String "(?<Unit>Mhz|MIPS)\s+\:\s+(?<Value>[\d\.]+)" |
24+
Select-Object -First 1 -ExpandProperty Matches |
25+
ForEach-Object {
26+
$_.Groups["Value"].Value -as [int]
27+
}
28+
} elseif ($executionContext.SessionState.PSVariable.Get('IsMacOS').Value) {
29+
(sysctl -n hw.cpufrequency) / 1e6 -as [int]
30+
} else {
31+
$getCimInstance = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Get-CimInstance','Cmdlet')
32+
if ($getCimInstance) {
33+
& $getCimInstance -Class Win32_Processor |
34+
Select-Object -ExpandProperty MaxClockSpeed
35+
}
36+
}
37+
#endregion
38+
2039
$mySelf = $MyInvocation.MyCommand.ScriptBlock
2140

2241
& {
@@ -52,15 +71,19 @@ $buildTimes | ConvertTo-Html -Title BuildTimes > ./times.html
5271
body { height: 100vh; max-width: 100vw; margin:0 }
5372
5473
svg { height: 5%; }
55-
summary { font-size: 2rem; }
74+
h1,h2, h3 { text-align: center; }
75+
.techniqueSummary { font-size: 2rem; }
5676
5777
"
5878
"</style>"
5979
"</head>"
6080
"<body>"
81+
"<h1>4kb Markdown Files Benchmark</h1>"
82+
"<h2>Time to build 4096 markdown files</h2>"
83+
"<h3>Last built at $([DateTime]::UtcNow.ToString("s")) running @ $cpuSpeed Mhz</h3>"
6184
foreach ($buildTime in $buildTimes) {
6285
"<details open>"
63-
"<summary>$($buildTime.Technique) ($([Math]::Round(
86+
"<summary class='techniqueSummary'>$($buildTime.Technique) ($([Math]::Round(
6487
$buildTime.Time.TotalSeconds, 2
6588
))s)</summary>"
6689
"<details>"

0 commit comments

Comments
 (0)