50 lines
1.1 KiB
PowerShell
50 lines
1.1 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[ValidateSet("samply", "flamegraph")]
|
|
[string]$Profiler = "flamegraph",
|
|
[int]$ProfileSeconds = 4,
|
|
[string]$Scenario = "shared_runtime_live_http_transfer/tight_cap_6way",
|
|
[string]$OutputDir
|
|
)
|
|
|
|
Set-StrictMode -Version Latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$repoRoot = Split-Path -Parent (Split-Path -Parent $PSScriptRoot)
|
|
$OutputDir = if ([string]::IsNullOrWhiteSpace($OutputDir)) {
|
|
Join-Path $repoRoot "artifacts\shared-runtime-http-pressure-profile"
|
|
} else {
|
|
$OutputDir
|
|
}
|
|
$profileScript = Join-Path $repoRoot "scripts\perf\profile_shared_runtime_http_pressure.ps1"
|
|
|
|
$msudoArgs = @(
|
|
"--same-console",
|
|
"--wait",
|
|
"--user",
|
|
"admin",
|
|
"--current-directory",
|
|
$repoRoot,
|
|
"--",
|
|
"pwsh",
|
|
"-NoLogo",
|
|
"-NoProfile",
|
|
"-ExecutionPolicy",
|
|
"Bypass",
|
|
"-File",
|
|
$profileScript,
|
|
"-Profiler",
|
|
$Profiler,
|
|
"-ProfileSeconds",
|
|
$ProfileSeconds.ToString(),
|
|
"-Scenario",
|
|
$Scenario,
|
|
"-OutputDir",
|
|
$OutputDir
|
|
)
|
|
|
|
& msudo @msudoArgs
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "Elevated profiler command failed with exit code $LASTEXITCODE."
|
|
}
|