체크포인트 로그에 레벨 소요시간 표시
This commit is contained in:
@@ -194,7 +194,7 @@ internal static class Program
|
||||
checkpointPath = string.IsNullOrWhiteSpace(checkpointPath) ? "stage_checkpoint.json" : checkpointPath;
|
||||
var checkpointEnabled = !string.IsNullOrWhiteSpace(checkpointPath);
|
||||
|
||||
void SaveCheckpoint(List<GeneratedLevel> snapshot, int lastId)
|
||||
void SaveCheckpoint(List<GeneratedLevel> snapshot, int lastId, TimeSpan levelElapsed)
|
||||
{
|
||||
if (!checkpointEnabled) return;
|
||||
// 매 레벨마다(또는 마지막 레벨) 누적 JSON을 디스크에 기록한다.
|
||||
@@ -202,7 +202,7 @@ internal static class Program
|
||||
{
|
||||
var json = JsonSerializer.Serialize(snapshot, options);
|
||||
File.WriteAllText(checkpointPath, json);
|
||||
status.ShowLine($"체크포인트 저장: 레벨 {lastId}까지 -> {checkpointPath}");
|
||||
status.ShowLine($"체크포인트 저장: 레벨 {lastId}까지 ({StatusReporter.FormatDuration(levelElapsed)}) -> {checkpointPath}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -488,7 +488,7 @@ internal sealed class LevelGenerator
|
||||
_trace = Environment.GetEnvironmentVariable("NEKOBAN_DEBUG") == "1";
|
||||
}
|
||||
|
||||
public List<GeneratedLevel> BuildRange(int startId, int endId, Action<List<GeneratedLevel>, int>? onCheckpoint = null)
|
||||
public List<GeneratedLevel> BuildRange(int startId, int endId, Action<List<GeneratedLevel>, int, TimeSpan>? onCheckpoint = null)
|
||||
{
|
||||
foreach (var band in _bands)
|
||||
{
|
||||
@@ -506,8 +506,9 @@ internal sealed class LevelGenerator
|
||||
var levelStopwatch = Stopwatch.StartNew();
|
||||
var level = BuildSingle(id, band, levelStopwatch);
|
||||
level = TrimLevel(level);
|
||||
levelStopwatch.Stop();
|
||||
output.Add(level);
|
||||
onCheckpoint?.Invoke(output, id);
|
||||
onCheckpoint?.Invoke(output, id, levelStopwatch.Elapsed);
|
||||
}
|
||||
|
||||
return output;
|
||||
|
||||
Reference in New Issue
Block a user