Skip to content

Commit

Permalink
add stopwatch
Browse files Browse the repository at this point in the history
  • Loading branch information
Miepee committed Aug 1, 2024
1 parent 5de70c5 commit 7ef026c
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions YAMS-LIB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,17 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath)

SeedObject? seedObject = JsonSerializer.Deserialize<SeedObject>(File.ReadAllText(jsonPath));

// Read 1.5.x data
gmData = new UndertaleData();
Stopwatch sw = new Stopwatch();
sw.Start();

// Read 1.5.x data
using (FileStream fs = new FileInfo(am2rPath).OpenRead())
{
gmData = UndertaleIO.Read(fs);
}
sw.Stop();
var afterRead = sw.Elapsed;
sw.Start();

Console.WriteLine("Read data file.");
decompileContext = new GlobalDecompileContext(gmData, false);
Expand Down Expand Up @@ -633,9 +637,15 @@ public static void Main(string am2rPath, string outputAm2rPath, string jsonPath)

// Write back to disk
ExtensionMethods.FlushCode();
sw.Stop();
var beforeWrite = sw.Elapsed;
sw.Start();
using (FileStream fs = new FileInfo(outputAm2rPath).OpenWrite())
{
UndertaleIO.Write(fs, gmData, Console.WriteLine);
}
sw.Stop();
Console.WriteLine($"Total Time: {sw.Elapsed}");
Console.WriteLine($"Patching Time Only: {beforeWrite-afterRead}");
}
}

0 comments on commit 7ef026c

Please sign in to comment.