I am getting the 100% CPU Usage issue in my Windows service application.
I used the performance analyser of Visual Studio 2012 and got the below root cause which is having more than 90% CPU usage and shown as a hot path.
We are reading file from shared path and inserting the content of it in DB. Using threading mechanism for it.
We are using Regexlist of around 20 regex and matching each regex of it with file's each line text and if it is matching we are sending that line as an email.
please help if below function can be done in some other way as it is showing as highest CPU usage for the same.
private bool ShouldInclude(LogLine logLine)
{
if (_includeRegexList.Count == 0)
return true;
foreach (Regex regex in _includeRegexList)
{
if (regex.IsMatch(logLine.Text))
return true;
}
return false;
I used the performance analyser of Visual Studio 2012 and got the below root cause which is having more than 90% CPU usage and shown as a hot path.
We are reading file from shared path and inserting the content of it in DB. Using threading mechanism for it.
We are using Regexlist of around 20 regex and matching each regex of it with file's each line text and if it is matching we are sending that line as an email.
please help if below function can be done in some other way as it is showing as highest CPU usage for the same.
private bool ShouldInclude(LogLine logLine)
{
if (_includeRegexList.Count == 0)
return true;
foreach (Regex regex in _includeRegexList)
{
if (regex.IsMatch(logLine.Text))
return true;
}
return false;