ProcessGetPath catching exception consumes too much time
Posted: 19 Aug 2023, 06:48
I wrote a function to get the file paths of all running processes, however some processes throw exceptions due to insufficient privileges.
That's normal, but when I tried to catch these exceptions, I found that it taked too much time.
It takes 732ms on my pc, I don't think it is normal. Can this be optimized?
That's normal, but when I tried to catch these exceptions, I found that it taked too much time.
Code: Select all
pid := ProcessExist("winlogon.exe")
DllCall("QueryPerformanceFrequency", "Int64*", &freq := 0)
DllCall("QueryPerformanceCounter", "Int64*", &CounterBefore := 0)
loop 100
try
ProcessGetPath(pid)
DllCall("QueryPerformanceCounter", "Int64*", &CounterAfter := 0)
MsgBox "Elapsed QPC time is " . (CounterAfter - CounterBefore) / freq * 1000 " ms"