G
Guest
I need to read the entire eventlog and parse it. The application uses vb.net and the EventLog object. The problem i'm having is that it can take less then a second up to 15 seconds to read all entries in the eventlog. I used Perfmon and found the following two counters that were used heavily
..NET CLR Security Total Runtime Check
..NET CLR Interop # of marshallin
I have written some sample code that shows my problem
Module Module
'<System.Security.SuppressUnmanagedCodeSecurity()>
Sub Main(
'Dim evl As New EventLog("System"
Dim evl As New EventLog("Application"
Dim str As Strin
Dim startTime, endTime As Dat
str = "No entries: " & evl.Entries.Coun
Debug.WriteLine(str
Console.WriteLine(str
For x As Integer = 0 To
startTime = No
For Each entry As EventLogEntry In evl.Entrie
str = entry.UserName & entry.Source & entry.MachineName &
entry.Category & entry.CategoryNumber & entry.EntryType &
entry.EventID & entry.Index & entry.TimeGenerated & entry.Messag
Nex
endTime = No
str = "Started: " & startTime.ToString("HH:mm:ss.ffff") & vbCrLf &
"Ended: " & endTime.ToString("HH:mm:ss.ffff"
Debug.WriteLine(str
Console.WriteLine(str
Nex
End Su
End Modul
When i run it on a P4 machine (3GHz and 2G ram) i get the following results
No entries: 170
Started: 12:04:34.875
Ended: 12:04:38.890
No entries: 193
Started: 12:05:37.937
Ended: 12:05:39.859
Since the application i'm writing is a graphical one i don't want any hangings
Any ideas how i can trim the system or change the code to make it run faster
..NET CLR Security Total Runtime Check
..NET CLR Interop # of marshallin
I have written some sample code that shows my problem
Module Module
'<System.Security.SuppressUnmanagedCodeSecurity()>
Sub Main(
'Dim evl As New EventLog("System"
Dim evl As New EventLog("Application"
Dim str As Strin
Dim startTime, endTime As Dat
str = "No entries: " & evl.Entries.Coun
Debug.WriteLine(str
Console.WriteLine(str
For x As Integer = 0 To
startTime = No
For Each entry As EventLogEntry In evl.Entrie
str = entry.UserName & entry.Source & entry.MachineName &
entry.Category & entry.CategoryNumber & entry.EntryType &
entry.EventID & entry.Index & entry.TimeGenerated & entry.Messag
Nex
endTime = No
str = "Started: " & startTime.ToString("HH:mm:ss.ffff") & vbCrLf &
"Ended: " & endTime.ToString("HH:mm:ss.ffff"
Debug.WriteLine(str
Console.WriteLine(str
Nex
End Su
End Modul
When i run it on a P4 machine (3GHz and 2G ram) i get the following results
No entries: 170
Started: 12:04:34.875
Ended: 12:04:38.890
No entries: 193
Started: 12:05:37.937
Ended: 12:05:39.859
Since the application i'm writing is a graphical one i don't want any hangings
Any ideas how i can trim the system or change the code to make it run faster