Improvement request: Monitoring (tail -f) feature is slow because it is timer-driven => should be event-driven
-
Monitoring (tail -f) feature seems to be working based on timer-event and therefore it is not real-time and there is 1/2 timer period delay on the average. For example, if the timer period for monitoring is set to 1 sec, 0.5 sec delay on the average will happen while monitoring. This is very bad when monitoring multi-thread and/or multi-process programs. Even if the timer period is set to the minimum (let’s say 10ms) there is still delay in logging display.
There is a very good windows api for realtime event notification:
HANDLE WINAPI FindFirstChangeNotification(
In LPCTSTR lpPathName,
In BOOL bWatchSubtree,
In DWORD dwNotifyFilter
);For example,
HANDLE fch = FindFirstChangeNotification (szNewPath, FALSE, FILE_NOTIFY_CHANGE_SIZE);Using this will make monitoring realtime(no delay at all) unlike timer-driven way. It’s because the windows system notifies the file size change immediately from the kernel leverl.
So I hope next version improves the monitoring feature using the above api.
CodeProject has an tail -f utility article that shows the use of FindFirstChangeNotification.
https://www.codeproject.com/Articles/5441/Tail-for-Win-A-Windows-version-of-the-Unix-tail
This article will give the starting point for the improvement.
This article has one more super great feature that is very very useful when monitoring.
That is word-level highlighting with colour.If NotePad++ adds these two features (event-driven plus word-highlighting) it will be perfect for developers.
thx