mirror of
https://github.com/claunia/osrepodbmgr.git
synced 2025-12-16 19:14:25 +00:00
* osrepodbmgr.Core/Workers/Clamd.cs:
* osrepodbmgr.Core/Workers/Miscellaneous.cs: Added debug timers.
This commit is contained in:
@@ -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>
|
2017-05-19 Natalia Portillo <claunia@claunia.com>
|
||||||
|
|
||||||
* Workers/Clamd.cs:
|
* Workers/Clamd.cs:
|
||||||
|
|||||||
@@ -147,17 +147,31 @@ namespace osrepodbmgr.Core
|
|||||||
if(UpdateProgress != null)
|
if(UpdateProgress != null)
|
||||||
UpdateProgress("Uncompressing file...", null, 0, 0);
|
UpdateProgress("Uncompressing file...", null, 0, 0);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Restart();
|
||||||
|
#endif
|
||||||
zStream.CopyTo(outFs);
|
zStream.CopyTo(outFs);
|
||||||
zStream.Close();
|
zStream.Close();
|
||||||
outFs.Close();
|
outFs.Close();
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Stop();
|
||||||
|
Console.WriteLine("Core.ClamScanFileFromRepo({0}): Uncompressing took {1} seconds", file, stopwatch.Elapsed.TotalSeconds);
|
||||||
|
#endif
|
||||||
|
|
||||||
if(UpdateProgress != null)
|
if(UpdateProgress != null)
|
||||||
UpdateProgress("Requesting local scan to clamd server...", null, 0, 0);
|
UpdateProgress("Requesting local scan to clamd server...", null, 0, 0);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Restart();
|
||||||
|
#endif
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
result = await clam.ScanFileOnServerMultithreadedAsync(tmpFile);
|
result = await clam.ScanFileOnServerMultithreadedAsync(tmpFile);
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Stop();
|
||||||
|
Console.WriteLine("Core.ClamScanFileFromRepo({0}): Clamd took {1} seconds to scan", file, stopwatch.Elapsed.TotalSeconds);
|
||||||
|
#endif
|
||||||
|
|
||||||
File.Delete(tmpFile);
|
File.Delete(tmpFile);
|
||||||
}
|
}
|
||||||
@@ -166,10 +180,17 @@ namespace osrepodbmgr.Core
|
|||||||
if(UpdateProgress != null)
|
if(UpdateProgress != null)
|
||||||
UpdateProgress("Requesting local scan to clamd server...", null, 0, 0);
|
UpdateProgress("Requesting local scan to clamd server...", null, 0, 0);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Restart();
|
||||||
|
#endif
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
result = await clam.ScanFileOnServerMultithreadedAsync(repoPath);
|
result = await clam.ScanFileOnServerMultithreadedAsync(repoPath);
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Stop();
|
||||||
|
Console.WriteLine("Core.ClamScanFileFromRepo({0}): Clamd took {1} seconds to scan", file, stopwatch.Elapsed.TotalSeconds);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -195,10 +216,17 @@ namespace osrepodbmgr.Core
|
|||||||
if(UpdateProgress != null)
|
if(UpdateProgress != null)
|
||||||
UpdateProgress("Uploading file to clamd server...", null, 0, 0);
|
UpdateProgress("Uploading file to clamd server...", null, 0, 0);
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Restart();
|
||||||
|
#endif
|
||||||
Task.Run(async () =>
|
Task.Run(async () =>
|
||||||
{
|
{
|
||||||
result = await clam.SendAndScanFileAsync(zStream);
|
result = await clam.SendAndScanFileAsync(zStream);
|
||||||
}).Wait();
|
}).Wait();
|
||||||
|
#if DEBUG
|
||||||
|
stopwatch.Stop();
|
||||||
|
Console.WriteLine("Core.ClamScanFileFromRepo({0}): Clamd took {1} seconds to scan", file, stopwatch.Elapsed.TotalSeconds);
|
||||||
|
#endif
|
||||||
zStream.Close();
|
zStream.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ namespace osrepodbmgr.Core
|
|||||||
static int zipCounter;
|
static int zipCounter;
|
||||||
static string zipCurrentEntryName;
|
static string zipCurrentEntryName;
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
static Stopwatch stopwatch = new Stopwatch();
|
||||||
|
#endif
|
||||||
|
|
||||||
static string stringify(byte[] hash)
|
static string stringify(byte[] hash)
|
||||||
{
|
{
|
||||||
StringBuilder hashOutput = new StringBuilder();
|
StringBuilder hashOutput = new StringBuilder();
|
||||||
|
|||||||
Reference in New Issue
Block a user