diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2021-01-14 08:07:43 +0100 |
|---|---|---|
| committer | j-p <jp_bruyere@hotmail.com> | 2021-02-06 20:28:02 +0100 |
| commit | 2ab44f600bd0ecab04d03ba08fdc17ea195babf2 (patch) | |
| tree | 916e61f3a6776ea97f73d77ea8b601684c2ad5f2 /Samples/PerfTests | |
| parent | 0f08742ef206f006db97a8d2bc67b1c4cae34deb (diff) | |
label, cached line width in pixel in LineSpan struct, use stackalloc for a single utf8 conversion for size and print, perfs and samplebase
Diffstat (limited to 'Samples/PerfTests')
| -rw-r--r-- | Samples/PerfTests/Program.cs | 14 | ||||
| -rw-r--r-- | Samples/PerfTests/Properties/launchSettings.json | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/Samples/PerfTests/Program.cs b/Samples/PerfTests/Program.cs index 7a62fd8c..73b97448 100644 --- a/Samples/PerfTests/Program.cs +++ b/Samples/PerfTests/Program.cs @@ -16,6 +16,7 @@ namespace PerfTests readonly bool resetItors = false; readonly bool screenOutput = false; readonly string inDirectory = "Interfaces";//directory to test + readonly string outFilePath; Stream outStream; @@ -24,7 +25,8 @@ namespace PerfTests bool logToDisk => writer != null; void writeHeader (TextWriter txtWriter) { - txtWriter.WriteLine ($"Crow perf test ({clientRectangle.Width} X {clientRectangle.Height}), repeat count = {count}, reset style and templates = {resetItors}"); + txtWriter.WriteLine ($"Crow perf test ({clientRectangle.Width} X {clientRectangle.Height}), output to screen = { screenOutput }"); + txtWriter.WriteLine ($"repeat = {count}, update cycles = {updateCycles} reset Instantiators = {resetItors}"); txtWriter.WriteLine ($"git:{ThisAssembly.Git.Commit} {ThisAssembly.Git.Branch} {ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch} {ThisAssembly.Git.SemVer.Label}"); } @@ -39,6 +41,7 @@ namespace PerfTests Console.WriteLine ("-r,--reset:\n\tenable clear iterators after each test file."); Console.WriteLine ("-u,--update:\n\tmeasure 'n' update cycle with DateTime.Now string notified."); Console.WriteLine ("-s,--screen:\n\tenable output to screen."); + Console.WriteLine ("--help:\n\tthis help message."); } public TestInterface (string[] args, int width = 800, int height = 600) @@ -86,7 +89,7 @@ namespace PerfTests case "--screen": screenOutput = true; break; - + case "--help": default: throw new Exception (); } @@ -107,7 +110,8 @@ namespace PerfTests Directory.CreateDirectory (dirName); string filename = "crow-" + DateTime.Now.ToString ("yyyy-MM-dd-HH-mm") +".perflog"; - outStream = new FileStream (Path.Combine (dirName, filename), FileMode.Create); + outFilePath = Path.Combine (dirName, filename); + outStream = new FileStream (outFilePath, FileMode.Create); writer = new StreamWriter (outStream); writeHeader (writer); writer.WriteLine ("Path;Min;Mean;Max;Allocated;LostMem"); @@ -127,6 +131,9 @@ namespace PerfTests throw new FileNotFoundException ("Input directory not found: " + dirName); testDir (dirName); + + if (logToDisk) + Console.WriteLine ($"\ntest log written to: {outFilePath}"); } protected override void Dispose (bool disposing) { @@ -222,6 +229,7 @@ namespace PerfTests double lostMem = (double)(totMemAfter - totMemBefore) / 1024.0; if (logToDisk) { writer.WriteLine ($"{f};{min};{mean};{max};{allocAfter - allocBefore};{totMemAfter - totMemBefore}"); + Console.Write ("."); } else { if (miliseconds) Console.WriteLine ($"{label,-50}|{min,10}|{mean,10}|{max,10}| {allocated,8:0.0} | {lostMem,8:0.0} |"); diff --git a/Samples/PerfTests/Properties/launchSettings.json b/Samples/PerfTests/Properties/launchSettings.json index c5470b40..278f5ab3 100644 --- a/Samples/PerfTests/Properties/launchSettings.json +++ b/Samples/PerfTests/Properties/launchSettings.json @@ -2,7 +2,7 @@ "profiles": { "PerfTests": { "commandName": "Project", - "commandLineArgs": "-c 5 -u 99 -s -i Interfaces/PerfLabels" + "commandLineArgs": "-c 20 -u 99 -s -i Interfaces/PerfLabels" } } }
\ No newline at end of file |