From e64c25949d5314fdc312695744da52a3dc0bb54c Mon Sep 17 00:00:00 2001 From: Sean Date: Fri, 4 Apr 2025 17:27:01 -0400 Subject: [PATCH] Add profiler --- Translate/Translate/Services/MainService.cs | 21 +++++++++++++++++++-- Translate/Translate/Translate.csproj | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Translate/Translate/Services/MainService.cs b/Translate/Translate/Services/MainService.cs index c3e09cf..83e4538 100644 --- a/Translate/Translate/Services/MainService.cs +++ b/Translate/Translate/Services/MainService.cs @@ -1,6 +1,7 @@ using Translate.Interface; using Microsoft.Extensions.Configuration; using System.Text; +using MarketData.Utils; namespace Translate.Services { @@ -14,6 +15,24 @@ namespace Translate.Services public class MainService : IMainService { public void RunService(String[] args,IConfiguration configuration) + { + Profiler profiler = new Profiler(); + + try + { + Translate(args, configuration); + } + catch(Exception exception) + { + Console.WriteLine($"{exception.ToString()}"); + } + finally + { + Console.WriteLine($"Translate done, total took {Utility.FormatNumber(profiler.End(),0,true)}(ms"); + } + } + + private void Translate(String[] args,IConfiguration configuration) { bool includeInserts = true; bool useMaxLines = false; @@ -129,8 +148,6 @@ namespace Translate.Services streamWriter.Flush(); streamWriter.Close(); streamWriter.Dispose(); - - Console.WriteLine("Done."); } } } \ No newline at end of file diff --git a/Translate/Translate/Translate.csproj b/Translate/Translate/Translate.csproj index f0735f6..a3784c3 100644 --- a/Translate/Translate/Translate.csproj +++ b/Translate/Translate/Translate.csproj @@ -13,6 +13,10 @@ translate + + + +