Skip to content

Commit f4ab6d5

Browse files
authored
Merge pull request #13 from hyperlight-dev/fix-sparsify-message
fix: sparsify message reports resulting disk size instead of amount removed
2 parents a633326 + 5be8d3a commit f4ab6d5

2 files changed

Lines changed: 5 additions & 11 deletions

File tree

examples/dotnet-nativeaot/HelloNativeAot.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
<InvariantGlobalization>true</InvariantGlobalization>
88
</PropertyGroup>
99
<ItemGroup>
10-
<PackageReference Include="runtime.linux-musl-x64.Microsoft.DotNet.ILCompiler" Version="9.0.15" />
10+
<PackageReference Include="runtime.linux-musl-x64.Microsoft.DotNet.ILCompiler" Version="9.0.16" />
1111
</ItemGroup>
1212
</Project>

host/src/lib.rs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1578,11 +1578,8 @@ fn sparsify_snapshot(path: &Path) -> Result<()> {
15781578
drop(mmap);
15791579

15801580
if punched > 0 {
1581-
eprintln!(
1582-
" sparsified: punched {} zero pages ({} MiB saved on disk)",
1583-
punched,
1584-
punched * 4 / 1024
1585-
);
1581+
let disk_mib = (len - punched * PAGE as u64) / 1024 / 1024;
1582+
eprintln!(" sparsified: {disk_mib} MiB on disk (punched {punched} zero pages)",);
15861583
}
15871584

15881585
Ok(())
@@ -1669,11 +1666,8 @@ fn sparsify_snapshot(path: &Path) -> Result<()> {
16691666
drop(mmap);
16701667

16711668
if punched > 0 {
1672-
eprintln!(
1673-
" sparsified: punched {} zero pages ({} MiB saved on disk)",
1674-
punched,
1675-
punched * 4 / 1024
1676-
);
1669+
let disk_mib = (len - punched * PAGE as u64) / 1024 / 1024;
1670+
eprintln!(" sparsified: {disk_mib} MiB on disk (punched {punched} zero pages)",);
16771671
}
16781672

16791673
Ok(())

0 commit comments

Comments
 (0)