I have a program that loads System's Event logs to a Hastable to be used. The problem is that it's utilizing 100% of the CPU. What is the best solution to lower the usage using API calls.
Hashtable currentLog = (Hashtable)_logs[l.Log];
foreach (EventLogEntry e in l.Entries)
{
if (_lastRun <= e.TimeWritten.ToUniversalTime() )
{
if (_verboseOutput)
{
Logger.TraceWrite(String.Format(
"Source={0}, EventId={1}, Date/Time={2}, Message={3}",
e.Source,
e.EventID,
e.TimeWritten,
e.Message));
}
string key = GetEventKey(e);
if (currentLog[key] == null)
{
currentLog[key] = e;
}
}
}