Community
    • Login

    Improvement request: Monitoring (tail -f) feature is slow because it is timer-driven => should be event-driven

    Scheduled Pinned Locked Moved General Discussion
    event-driventail
    1 Posts 1 Posters 1.4k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • HaeRim LeeH Offline
      HaeRim Lee
      last edited by HaeRim Lee

      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
      );

      https://msdn.microsoft.com/query/dev15.query?appId=Dev15IDEF1&l=EN-US&k=k(BUFFER%2FBuffer%3A%3AFindFirstChangeNotification);k(Buffer%3A%3AFindFirstChangeNotification);k(FindFirstChangeNotification);k(DevLang-C%2B%2B);k(TargetOS-Windows)&rd=true

      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

      1 Reply Last reply Reply Quote 1

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post
      The Community of users of the Notepad++ text editor.
      Powered by NodeBB | Contributors