Skip to content

Commit eeb2ba4

Browse files
committed
feat: adapt to hyperlight-host 0.16.0 from crates.io
Switch from git dep (danbugs/hyperlight) to crates.io hyperlight-host 0.16.0. Key API changes: - Snapshot format: to_file/from_file_unchecked -> OCI save/load - snapshot.hls (single file) -> snapshot/ (OCI dir) - map_file_cow: 3-arg -> 2-arg (label param removed) - restore_preserving_file_mappings removed; re-map initrd after restore - Remove sparsify_snapshot (OCI format handles storage) - Remove whp-no-surrogate feature (now runtime env var) - Add max_surrogates API to configure_surrogates/InstallOptions/Runtime - Reduce default heap from 2560 MiB to 1280 MiB Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent 0350d64 commit eeb2ba4

10 files changed

Lines changed: 392 additions & 325 deletions

File tree

.github/workflows/benchmarks.yml

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -287,9 +287,9 @@ jobs:
287287
- name: "Snapshot size"
288288
if: steps.kvm_check.outputs.available == 'true'
289289
run: |
290-
snap=".pyhl/snapshot.hls"
291-
apparent=$(($(stat -c '%s' "$snap") / 1024 / 1024))
292-
disk=$(($(stat -c '%b' "$snap") * 512 / 1024 / 1024))
290+
snap=".pyhl/snapshot"
291+
apparent=$(($(find "$snap" -type f -exec stat -c '%s' {} + | paste -sd+ | bc) / 1024 / 1024))
292+
disk=$(($(find "$snap" -type f -exec stat -c '%b' {} + | paste -sd+ | bc) * 512 / 1024 / 1024))
293293
echo "| Metric | Value |"
294294
echo "|--------|-------|"
295295
echo "| Apparent size | ${apparent} MiB |"
@@ -483,27 +483,10 @@ jobs:
483483
- name: "Snapshot size"
484484
shell: pwsh
485485
run: |
486-
$snap = ".pyhl\snapshot.hls"
487-
$f = Get-Item $snap
488-
$apparentMiB = [math]::Round($f.Length / 1MB)
489-
# GetCompressedFileSize returns actual on-disk allocation for sparse files
490-
$wide = $f.FullName
491-
Add-Type -TypeDefinition @"
492-
using System;
493-
using System.Runtime.InteropServices;
494-
public class SparseHelper {
495-
[DllImport("kernel32.dll", SetLastError=true, CharSet=CharSet.Unicode)]
496-
public static extern uint GetCompressedFileSizeW(string lpFileName, out uint lpFileSizeHigh);
497-
}
498-
"@ -ErrorAction SilentlyContinue
499-
$high = [uint32]0
500-
$low = [SparseHelper]::GetCompressedFileSizeW($wide, [ref]$high)
501-
if ($low -ne [uint32]::MaxValue) {
502-
$diskBytes = ([uint64]$high -shl 32) -bor [uint64]$low
503-
$diskMiB = [math]::Round($diskBytes / 1MB)
504-
} else {
505-
$diskMiB = $apparentMiB
506-
}
486+
$snap = ".pyhl\snapshot"
487+
$files = Get-ChildItem -Path $snap -Recurse -File
488+
$apparentMiB = [math]::Round(($files | Measure-Object -Property Length -Sum).Sum / 1MB)
489+
$diskMiB = $apparentMiB
507490
Write-Host "| Metric | Value |"
508491
Write-Host "|--------|-------|"
509492
Write-Host "| Apparent size | ${apparentMiB} MiB |"

0 commit comments

Comments
 (0)