From 0759cb3f39cec63ce505eec86a2005e90a40fc2c Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Fri, 19 May 2017 01:55:57 +0100 Subject: [PATCH] * osrepodbmgr.Core/Workers/Clamd.cs: * osrepodbmgr.Core/Workers/Miscellaneous.cs: Added debug timers. --- osrepodbmgr.Core/ChangeLog | 8 +++++++ osrepodbmgr.Core/Workers/Clamd.cs | 28 +++++++++++++++++++++++ osrepodbmgr.Core/Workers/Miscellaneous.cs | 4 ++++ 3 files changed, 40 insertions(+) diff --git a/osrepodbmgr.Core/ChangeLog b/osrepodbmgr.Core/ChangeLog index 750a2ce..f0e8b6b 100644 --- a/osrepodbmgr.Core/ChangeLog +++ b/osrepodbmgr.Core/ChangeLog @@ -1,3 +1,11 @@ +2017-05-19 Natalia Portillo + + * Workers/Clamd.cs: + + + * Workers/Miscellaneous.cs: + Added debug timers. + 2017-05-19 Natalia Portillo * Workers/Clamd.cs: diff --git a/osrepodbmgr.Core/Workers/Clamd.cs b/osrepodbmgr.Core/Workers/Clamd.cs index 31e069f..4977bfb 100644 --- a/osrepodbmgr.Core/Workers/Clamd.cs +++ b/osrepodbmgr.Core/Workers/Clamd.cs @@ -147,17 +147,31 @@ namespace osrepodbmgr.Core if(UpdateProgress != null) UpdateProgress("Uncompressing file...", null, 0, 0); +#if DEBUG + stopwatch.Restart(); +#endif zStream.CopyTo(outFs); zStream.Close(); outFs.Close(); +#if DEBUG + stopwatch.Stop(); + Console.WriteLine("Core.ClamScanFileFromRepo({0}): Uncompressing took {1} seconds", file, stopwatch.Elapsed.TotalSeconds); +#endif if(UpdateProgress != null) UpdateProgress("Requesting local scan to clamd server...", null, 0, 0); +#if DEBUG + stopwatch.Restart(); +#endif Task.Run(async () => { result = await clam.ScanFileOnServerMultithreadedAsync(tmpFile); }).Wait(); +#if DEBUG + stopwatch.Stop(); + Console.WriteLine("Core.ClamScanFileFromRepo({0}): Clamd took {1} seconds to scan", file, stopwatch.Elapsed.TotalSeconds); +#endif File.Delete(tmpFile); } @@ -166,10 +180,17 @@ namespace osrepodbmgr.Core if(UpdateProgress != null) UpdateProgress("Requesting local scan to clamd server...", null, 0, 0); +#if DEBUG + stopwatch.Restart(); +#endif Task.Run(async () => { result = await clam.ScanFileOnServerMultithreadedAsync(repoPath); }).Wait(); +#if DEBUG + stopwatch.Stop(); + Console.WriteLine("Core.ClamScanFileFromRepo({0}): Clamd took {1} seconds to scan", file, stopwatch.Elapsed.TotalSeconds); +#endif } } else @@ -195,10 +216,17 @@ namespace osrepodbmgr.Core if(UpdateProgress != null) UpdateProgress("Uploading file to clamd server...", null, 0, 0); +#if DEBUG + stopwatch.Restart(); +#endif Task.Run(async () => { result = await clam.SendAndScanFileAsync(zStream); }).Wait(); +#if DEBUG + stopwatch.Stop(); + Console.WriteLine("Core.ClamScanFileFromRepo({0}): Clamd took {1} seconds to scan", file, stopwatch.Elapsed.TotalSeconds); +#endif zStream.Close(); } diff --git a/osrepodbmgr.Core/Workers/Miscellaneous.cs b/osrepodbmgr.Core/Workers/Miscellaneous.cs index cea7a0b..4fd2ecd 100644 --- a/osrepodbmgr.Core/Workers/Miscellaneous.cs +++ b/osrepodbmgr.Core/Workers/Miscellaneous.cs @@ -39,6 +39,10 @@ namespace osrepodbmgr.Core static int zipCounter; static string zipCurrentEntryName; +#if DEBUG + static Stopwatch stopwatch = new Stopwatch(); +#endif + static string stringify(byte[] hash) { StringBuilder hashOutput = new StringBuilder();