logging format

This commit is contained in:
glax 2023-04-23 16:23:06 +02:00
parent 6b5dddb1e3
commit edd931bca5

View File

@ -78,15 +78,17 @@ public class Server
Console.WriteLine($"{loaded++}/{allFiles.Count()} {filePath} " +
$"Time elapsed: {DateTime.Now - start} " +
$"Remaining {((DateTime.Now - start)/loaded)*(allFiles.Count-loaded)}");
if (shortest.Key.distance > result.distance)
shortest = new KeyValuePair<PathResult, string>(result, filePath);
if (fastest.Key.weight > result.weight)
fastest = new KeyValuePair<PathResult, string>(result, filePath);
if (calcTime.Key.calcTime > result.calcTime)
calcTime = new KeyValuePair<PathResult, string>(result, filePath);
}
Dictionary<PathResult, string> sortedCalcTime = results.OrderBy(result => result.Key.calcTime).ToDictionary(item => item.Key, item =>item.Value);
foreach (KeyValuePair<PathResult, string> kv in sortedCalcTime)
{
Console.WriteLine($"{kv.Key.distance:0.0} {kv.Key.weight:0.00} {kv.Key.calcTime} {kv.Value}");
}
KeyValuePair<PathResult, string> shortest = results.MinBy(result => result.Key.distance);
KeyValuePair<PathResult, string> fastest = results.MinBy(result => result.Key.weight);
KeyValuePair<PathResult, string> calcTime = results.MinBy(result => result.Key.calcTime);
Console.WriteLine($"\nShortest:\t{shortest.Key.distance:0.0} {shortest.Key.weight:0.00} {shortest.Key.calcTime} {shortest.Value}\n" +
$"Fastest:\t{fastest.Key.distance:0.0} {fastest.Key.weight:0.00} {fastest.Key.calcTime} {fastest.Value}\n" +
$"CalcTime:\t{calcTime.Key.distance:0.0} {calcTime.Key.weight:0.00} {calcTime.Key.calcTime} {calcTime.Value}");
@ -154,7 +156,7 @@ public class Server
if (newCompletedTasks > 0)
{
TimeSpan elapsedTime = DateTime.Now - startTime;
Console.WriteLine($"To calculate: {calcThreads.Count}(+{runningThreads.Count})/{totalTasks} Time Average: {(elapsedTime)/(completedTasks)} Elapsed: {elapsedTime} Remaining: {(elapsedTime)/(completedTasks)*calcThreads.Count}");
Console.WriteLine($"To calculate: {calcThreads.Count}(+{runningThreads.Count} running)/{totalTasks} Time Average: {(elapsedTime/completedTasks)} Elapsed: {elapsedTime} Remaining: {(elapsedTime/completedTasks*calcThreads.Count)}");
}
}
}