[SOLVED] cache of running PID #133
themighty1
started this conversation in
Ideas
Replies: 2 comments
-
We only look up the PID in /proc once (and only for NEW packets), in opensnitch/daemon/conman/connection.go Line 111 in 8cc6569 But it's true that we enter in FindProc() and get the PID's information even if the object for that PID (Process{}) is already created. We could have a cache of Process{} as you suggested. |
Beta Was this translation helpful? Give feedback.
0 replies
-
PR submitted evilsocket#342 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I noticed that we spend around 200 usec for each packet in procmon.FindProcess
opensnitch/daemon/conman/connection.go
Line 123 in 8cc6569
Unless I've overlooked something, we don't need to lookup the pid in /proc for every packet. We only need to look up the pid in /proc on the first packet from that pid and then to cache that value. For all subsequent packets from that pid, FindProcess() will return the cached value.
If the pid terminates, the cached values for that pid are cleared.
Beta Was this translation helpful? Give feedback.
All reactions