Release 1.1.0 with adaptive RAM and interactive previews
All checks were successful
Release AstroFrame / packages (push) Successful in 1m13s
All checks were successful
Release AstroFrame / packages (push) Successful in 1m13s
Replace fixed process, heap, frame and worker caps with physical RAM admission and CPU-scaled concurrency. Round Windows job budgets to native allocation boundaries. Add persistent cursor-centered zoom, drag and reset, fresh launches, cerulean update indicators and grey native startup backgrounds. Validate with isolated fixtures and a fake updater.
This commit is contained in:
parent
6b56c0b122
commit
a8e7a87b94
21 changed files with 271 additions and 80 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
|
@ -9,7 +9,6 @@
|
|||
<ItemGroup>
|
||||
<None Update="Fixtures/*.json" CopyToOutputDirectory="PreserveNewest" />
|
||||
<ProjectReference Include="../../src/AstroFrame.Engine/AstroFrame.Engine.csproj" />
|
||||
<RuntimeHostConfigurationOption Include="System.GC.HeapHardLimit" Value="3221225472" />
|
||||
<RuntimeHostConfigurationOption Include="System.GC.Server" Value="false" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ if(args.Length>0&&args[0]=="profile-workers")
|
|||
string[] all=Directory.GetFiles(args[1],"*.fit").Order().ToArray();int count=Math.Min(int.Parse(args[2]),all.Length),workers=int.Parse(args[3]);
|
||||
var files=Enumerable.Range(0,count).Select(i=>all[i*all.Length/count]).ToArray();var summaries=new System.Collections.Concurrent.ConcurrentDictionary<string,int>();var timer=Stopwatch.StartNew();
|
||||
await Parallel.ForEachAsync(files,new ParallelOptions{MaxDegreeOfParallelism=workers},async(path,ct)=>
|
||||
{var f=Fits.Inspect(path);await ResourcePolicy.WaitForHeadroom(ResourcePolicy.EstimateFrameBytes(f.Width,f.Height,2),ct);new StellarDetector().Measure(f,Fits.Read(path,ct),ct);summaries[f.Name]=f.StarCount;});
|
||||
{var f=Fits.Inspect(path);using var memory=await ResourcePolicy.Acquire(ResourcePolicy.EstimateFrameBytes(f.Width,f.Height,2),ct);new StellarDetector().Measure(f,Fits.Read(path,ct),ct);summaries[f.Name]=f.StarCount;});
|
||||
using var process=Process.GetCurrentProcess();Console.WriteLine(JsonSerializer.Serialize(new{workers,count,elapsedSeconds=timer.Elapsed.TotalSeconds,peakWorkingMiB=process.PeakWorkingSet64/1048576.0,peakPrivateMiB=process.PeakPagedMemorySize64/1048576.0,logicalProcessors=Environment.ProcessorCount,starCounts=summaries.OrderBy(x=>x.Key).Select(x=>x.Value)}));return;
|
||||
}
|
||||
if(args.Length>0&&args[0]=="resources")
|
||||
|
|
@ -42,7 +42,7 @@ if(args.Length>0&&args[0]=="analyze")
|
|||
var p=await new Analyzer().AnalyzeAsync(source,directory,existing,
|
||||
new DirectProgress(x=>{int pct=x.Total==0?0:x.Done*100/x.Total;if(pct/10!=last){last=pct/10;Console.WriteLine($"{x.Stage}: {x.Done}/{x.Total}");}}),CancellationToken.None);
|
||||
File.WriteAllText(Path.Combine(directory,"decisions.csv"),Export.Manifest(p));
|
||||
using var process=Process.GetCurrentProcess();var report=new {elapsedSeconds=watch.Elapsed.TotalSeconds,peakWorkingMB=process.PeakWorkingSet64/(1024.0*1024),peakCommittedMB=process.PeakPagedMemorySize64/(1024.0*1024),processLimitMB=ResourcePolicy.ProcessLimit/(1024*1024),heapLimitMB=ResourcePolicy.HeapLimit/(1024*1024),windowsLimitEnforced=ResourcePolicy.WindowsLimitEnforced,engine=Project.EngineVersion,validation="Unlabeled exploratory results; no evidence of stack parity",sessions=p.Frames.GroupBy(f=>f.Session).Select(g=>new{session=g.Key,frames=g.Count(),keep=g.Count(f=>f.Effective==Verdict.Keep),review=g.Count(f=>f.Effective==Verdict.Review),reject=g.Count(f=>f.Effective==Verdict.Reject),totalMinutes=g.Sum(f=>f.Exposure)/60,keepMinutes=g.Where(f=>f.Effective==Verdict.Keep).Sum(f=>f.Exposure)/60,stars=Range(g.Select(f=>(double)f.StarCount)),fwhm=Range(g.Select(f=>f.Fwhm)),flux=Range(g.Select(f=>f.Transparency)),matching=Range(g.Select(f=>f.MatchFraction)),causes=g.GroupBy(f=>f.Cause).ToDictionary(x=>x.Key,x=>x.Count())})};
|
||||
using var process=Process.GetCurrentProcess();var report=new {elapsedSeconds=watch.Elapsed.TotalSeconds,peakWorkingMB=process.PeakWorkingSet64/(1024.0*1024),peakCommittedMB=process.PeakPagedMemorySize64/(1024.0*1024),processLimitMB=ResourcePolicy.ProcessLimit/(1024*1024),heapLimitMB=GC.GetGCMemoryInfo().TotalAvailableMemoryBytes/(1024*1024),windowsLimitEnforced=ResourcePolicy.WindowsLimitEnforced,engine=Project.EngineVersion,validation="Unlabeled exploratory results; no evidence of stack parity",sessions=p.Frames.GroupBy(f=>f.Session).Select(g=>new{session=g.Key,frames=g.Count(),keep=g.Count(f=>f.Effective==Verdict.Keep),review=g.Count(f=>f.Effective==Verdict.Review),reject=g.Count(f=>f.Effective==Verdict.Reject),totalMinutes=g.Sum(f=>f.Exposure)/60,keepMinutes=g.Where(f=>f.Effective==Verdict.Keep).Sum(f=>f.Exposure)/60,stars=Range(g.Select(f=>(double)f.StarCount)),fwhm=Range(g.Select(f=>f.Fwhm)),flux=Range(g.Select(f=>f.Transparency)),matching=Range(g.Select(f=>f.MatchFraction)),causes=g.GroupBy(f=>f.Cause).ToDictionary(x=>x.Key,x=>x.Count())})};
|
||||
string json=JsonSerializer.Serialize(report,new JsonSerializerOptions{WriteIndented=true});File.WriteAllText(Path.Combine(directory,"report.json"),json);Console.WriteLine(json);return;
|
||||
}
|
||||
if(args.Length>0&&args[0]=="benchmark")
|
||||
|
|
@ -69,6 +69,22 @@ Check(!OperatingSystem.IsWindows()||ResourcePolicy.WindowsLimitEnforced,"Windows
|
|||
Check(ResourcePolicy.Reserve(32*ResourcePolicy.GiB)==8*ResourcePolicy.GiB,"32 GB machines reserve 8 GB physical RAM");
|
||||
Check(!ResourcePolicy.CanAnalyze(32*ResourcePolicy.GiB,7*ResourcePolicy.GiB,32*1024*1024),"low physical RAM pauses analysis");
|
||||
Check(ResourcePolicy.CanAnalyze(32*ResourcePolicy.GiB,12*ResourcePolicy.GiB,32*1024*1024),"sufficient RAM allows bounded analysis");
|
||||
Check(ResourcePolicy.MemoryBudget(32*ResourcePolicy.GiB)==24*ResourcePolicy.GiB&&ResourcePolicy.MemoryBudget(64*ResourcePolicy.GiB)==56*ResourcePolicy.GiB,"memory ceiling scales beyond 6 GB with installed RAM");
|
||||
Check(ResourcePolicy.MemoryBudget(4*ResourcePolicy.GiB)==3*ResourcePolicy.GiB,"small computers retain physical RAM headroom");
|
||||
Check(ResourcePolicy.WorkerLimit(16)>4&&ResourcePolicy.WorkerLimit(2)==1&&ResourcePolicy.WorkerLimit(64)==16,"worker count scales with CPU while leaving capacity for desktop work");
|
||||
var admission=new MemoryAdmission(()=>(8*ResourcePolicy.GiB,4*ResourcePolicy.GiB));
|
||||
using(var first=await admission.Acquire(2*ResourcePolicy.GiB,CancellationToken.None))
|
||||
{
|
||||
using var cancel=new CancellationTokenSource();var second=admission.Acquire(ResourcePolicy.GiB,cancel.Token);
|
||||
await Task.Delay(120);Check(!second.IsCompleted,"concurrent frames cannot spend the same RAM headroom");
|
||||
cancel.Cancel();bool canceled=false;try{await second;}catch(OperationCanceledException){canceled=true;}Check(canceled&&admission.ReservedBytes==2*ResourcePolicy.GiB,"waiting frames cancel without leaking reservations");
|
||||
}
|
||||
Check(admission.ReservedBytes==0,"completed frames release RAM admission");
|
||||
using(var next=await admission.Acquire(ResourcePolicy.GiB,CancellationToken.None)){next.Dispose();next.Dispose();Check(admission.ReservedBytes==0,"RAM leases release only once");}
|
||||
long free=ResourcePolicy.GiB;var changing=new MemoryAdmission(()=>(8*ResourcePolicy.GiB,Interlocked.Read(ref free)));
|
||||
var waiting=changing.Acquire(ResourcePolicy.GiB,CancellationToken.None);await Task.Delay(120);Check(!waiting.IsCompleted,"external memory pressure pauses allocation");
|
||||
Interlocked.Exchange(ref free,4*ResourcePolicy.GiB);using(var resumed=await waiting.WaitAsync(TimeSpan.FromSeconds(2)))Check(changing.ReservedBytes==ResourcePolicy.GiB,"available RAM increases resume processing dynamically");
|
||||
var ample=new MemoryAdmission(()=>(64*ResourcePolicy.GiB,40*ResourcePolicy.GiB));using(var large=await ample.Acquire(8*ResourcePolicy.GiB,CancellationToken.None))Check(ample.ReservedBytes>6*ResourcePolicy.GiB,"large machines admit work beyond the former fixed ceiling");
|
||||
bool budgetRefused=false;try{ResourcePolicy.CheckFrame(16000,16000,1);}catch(InvalidDataException){budgetRefused=true;}Check(budgetRefused,"oversized images refused before allocating pixels");
|
||||
var trend=Enumerable.Range(0,121).Select(i=>Synthetic(i,1-i*.002,160,1000+i*3)).ToList();Classification.Run(trend);
|
||||
Check(trend.All(f=>f.Automatic!=Verdict.Reject),"gradual transparency and background trends do not reject");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue