Skip to content

Commit b6f7241

Browse files
committed
chore: adopt upstream OCI snapshot format
- Point hyperlight-host at upstream hyperlight-dev/hyperlight main (no custom branch dependencies) - Adapt snapshot persistence to upstream OCI format (directory-based) - Re-map initrd via map_file_cow after every restore() since file mappings are separate hypervisor memory regions not in the snapshot - Reduce pyhl heap from 2560 MiB to 1280 MiB (minimum for Python warmup with pandas+docx) - Remove sparsify_snapshot code (was file-format specific) - Remove memmap2 and extra windows-sys features (no longer needed) - Update snapshot path references from file to directory in CI, tests, and examples Signed-off-by: danbugs <danilochiarlone@gmail.com>
1 parent 4460ae2 commit b6f7241

10 files changed

Lines changed: 292 additions & 308 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)