chore: initial sanitized public snapshot

This commit is contained in:
Aria2 Rust Pro Contributors
2026-07-18 15:24:15 +08:00
commit e489b29e01
321 changed files with 76890 additions and 0 deletions
@@ -0,0 +1,83 @@
[CmdletBinding()]
param(
[ValidateSet("samply", "flamegraph")]
[string]$Profiler = "samply",
[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
}
$manifestPath = Join-Path $repoRoot "Cargo.toml"
$null = New-Item -ItemType Directory -Path $OutputDir -Force
$artifactStem = ($Scenario -replace "[^A-Za-z0-9._-]", "-").Trim("-")
if ([string]::IsNullOrWhiteSpace($artifactStem)) {
throw "Scenario must produce a non-empty artifact stem."
}
$cargoArgs = @(
"bench",
"-p",
"aria2-rust-pro-tests",
"--bench",
"rpc_pressure",
$Scenario,
"--manifest-path",
$manifestPath,
"--",
"--profile-time",
$ProfileSeconds.ToString()
)
$metaPath = Join-Path $OutputDir "meta.txt"
@(
"timestamp=$([DateTimeOffset]::Now.ToString('O'))"
"profiler=$Profiler"
"profile_seconds=$ProfileSeconds"
"scenario=$Scenario"
) | Set-Content -LiteralPath $metaPath -Encoding UTF8
Push-Location $repoRoot
try {
switch ($Profiler) {
"samply" {
$outputPath = Join-Path $OutputDir "$artifactStem-profile.json.gz"
& samply record `
--save-only `
--no-open `
--output $outputPath `
--profile-name "shared-runtime-http-pressure" `
cargo @cargoArgs
}
"flamegraph" {
$outputPath = Join-Path $OutputDir "$artifactStem-flamegraph.svg"
& cargo flamegraph `
"-p" "aria2-rust-pro-tests" `
"--bench" "rpc_pressure" `
"--manifest-path" $manifestPath `
"--output" $outputPath `
"--" `
$Scenario `
"--profile-time" `
$ProfileSeconds
}
default {
throw "Unsupported profiler: $Profiler"
}
}
if ($LASTEXITCODE -ne 0) {
throw "Profiler command failed with exit code $LASTEXITCODE."
}
}
finally {
Pop-Location
}