You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I've written a a small application using libnethogs. It sometimes loops using 100% CPU when invoked multiple times within the same application (that is, leaving the nethogs screen and going back in, within the same program).
I think I've tracked down the problem - when using high CPU, vector pc_loop_fd_list contains duplicate fd's and so also in pc_loop_fd_set, causing select() in procedure wait_for_next_trigger() to immediately return. I assume these duplicates are from a previous invocation of libnethogs.
I've added pc_loop_fd_list.clear() in procedure nethogsmonitor_init() which seems to have fixed the problem. Perhaps you would kind enough to consider adding this fix. Maybe other static variables also need re-initialising in such circumstances.
Also, is there a way to get messages and errors back from libnethogs via an error buffer/call? At the moment it writes to the screen with cout/cerr/stdout/stderr which kind of messes up the ncurses output.
Regards, Daniel
The text was updated successfully, but these errors were encountered:
Hi,
I've written a a small application using libnethogs. It sometimes loops using 100% CPU when invoked multiple times within the same application (that is, leaving the nethogs screen and going back in, within the same program).
I think I've tracked down the problem - when using high CPU, vector pc_loop_fd_list contains duplicate fd's and so also in pc_loop_fd_set, causing select() in procedure wait_for_next_trigger() to immediately return. I assume these duplicates are from a previous invocation of libnethogs.
I've added pc_loop_fd_list.clear() in procedure nethogsmonitor_init() which seems to have fixed the problem. Perhaps you would kind enough to consider adding this fix. Maybe other static variables also need re-initialising in such circumstances.
Also, is there a way to get messages and errors back from libnethogs via an error buffer/call? At the moment it writes to the screen with cout/cerr/stdout/stderr which kind of messes up the ncurses output.
Regards, Daniel
The text was updated successfully, but these errors were encountered: