* osrepodbmgr.Core/Workers/Clamd.cs:

* osrepodbmgr.Core/Workers/Miscellaneous.cs:
	  Added debug timers.
This commit is contained in:
2017-05-19 01:55:57 +01:00
parent 9e136bb7c3
commit 0759cb3f39
3 changed files with 40 additions and 0 deletions

View File

@@ -1,3 +1,11 @@
2017-05-19 Natalia Portillo <claunia@claunia.com>
* Workers/Clamd.cs:
* Workers/Miscellaneous.cs:
Added debug timers.
2017-05-19 Natalia Portillo <claunia@claunia.com>
* Workers/Clamd.cs:

View File

@@ -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();
}

View File

@@ -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();