Menu

#6 garbage left on screen when toggling args display

v1.0 (example)
closed
nobody
None
5
2016-01-07
2015-07-10
David Braun
No

in version 15e toggling the Args top display (u) has a tendency to leave junk behind. This is because the format spec in the mvwprintw(...) call is incorrectly specified as "%-120s". It would be better to use "%-.120s". Even better would be to use

mvprintw(...,".... %-.*s", ..., COLS-2-1-n, args);

where
COLS - the current screen width
2 - allowance for left and right borders
n - the number of characters consumed by the format specs preceding the "%-.*s"
Curses doesn't truncate a line at the edge of the screen (or a pad). The line is wrapped to the next line. This will also leave junk on the left edge on occasion.
A similar trick should be used for the command field on the non-arg reports.

Related

Bugs: #6

Discussion

  • Nigel Griffiths

    Nigel Griffiths - 2015-07-10

    Pretty sure I have a global fix for this - to be released in 15g - soon.
    Thanks for pointing this out and reminding me to fix it.

     
    • David Braun

      David Braun - 2015-07-10

      cool - I'm kind of new to ncurses but I think the easiest fix would be to
      call

      wclrtobot(pad)

      right after the call to BANNER(...) (or add it to the BANNER macro) since
      your code redraws the banner every time through the main loop. I'm not sure
      this is the most efficient method but it should be robust.

      That just leaves the auto-linewrap problem. I mentioned this in another
      ticket.

      On Fri, Jul 10, 2015 at 10:27 AM, Nigel Griffiths nigelgriffiths@users.sf.net wrote:

      Pretty sure I have a global fix for this - to be released in 15g - soon.
      Thanks for pointing this out and reminding me to fix it.


      Status: open
      Group: v1.0 (example)
      Created: Fri Jul 10, 2015 03:38 AM UTC by David Braun
      Last Updated: Fri Jul 10, 2015 03:38 AM UTC
      Owner: nobody

      in version 15e toggling the Args top display (u) has a tendency to leave
      junk behind. This is because the format spec in the mvwprintw(...) call is
      incorrectly specified as "%-120s". It would be better to use "%-.120s".
      Even better would be to use

      mvprintw(...,".... %-.*s", ..., COLS-2-1-n, args);

      where
      COLS - the current screen width
      2 - allowance for left and right borders
      n - the number of characters consumed by the format specs preceding the
      "%-.*s"
      Curses doesn't truncate a line at the edge of the screen (or a pad). The
      line is wrapped to the next line. This will also leave junk on the left
      edge on occasion.
      A similar trick should be used for the command field on the non-arg
      reports.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/nmon/bugs/6/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #6

    • David Braun

      David Braun - 2015-07-14

      Nigel,

      I just picked up lmon15g.c - thanks for the fixes.

      Attached is a patch file that fixes/changes a couple of things.

      Display "---" if I/O numbers not available (see Top Mode 5)
      Output I/O counts to CSV fie

      Not reporting/displaying the I/O counts even for the user's processes is
      .... unfriendly so I modified it to display "---" as well as report the
      counts to the CSV file. If the counts aren't available report "0" in the
      file.

      Quote arg strings when output to file (also purge '"' from args)

      I changed the output of command arguments to the CSV file to be quoted with
      double quotes and left all characters alone (except ")

      Aggregate '-C' args

      Instead of keeping just the last occurrence of "-C list" they are
      aggregated.

      Fix average CPU utilization to account for multiple CPUs/Cores

      The IDLE value reported in /proc/uptime is the time spent in the IDLE loop
      by all CPUs/Cores. This means it potentially increases at N times the wall
      clock rage (N is number of CPUs/Cores). This is what was causing the
      average utilization to "overflow" in the K display

      Otherwise your tool if very handy.

      Dave

       
  • Nigel Griffiths

    Nigel Griffiths - 2015-07-15

    We seem to be mixing up these two bug reports - This one is for Screen Artefacts not process I/O stats but its done now so its too late.

    You are free (of course) to add any features you like for you requirements but a few comments on adding these to the main code.

    a) Top Process Mode 5 is to order processes based on I/O but if not root most of the processes have no I/O stats so the ordering fails - I don't see the point off having "---" and the order is random. For memory, I think it stays in the previous order. This is confusing miss information. Out of the popular Distro's only Debian/Ubuntu encourages non-root users. Most servers don't have regular users on system admin people as root.

    b) I/O reported to the file - good point.

    c) Reporting zero process I/O if not root user - argh! This is definitely miss information.
    This sort of thing generates loads of complaints and confusion. In the past I have used -1 which gets complaints but at least it can be explained. Changing all the code to output stats as numbers or strings in in error would triple the code size and soak up CPU cycles so there is no easy answer

    d) Adding double quotes - I would want to check a bunch of downstream graphing tools before making that level of change. Breaking other people work annoys them. Any particular reason? What tool do you graph with?

    e) -C list aggregated - hmm! don't see the point i.e. KISS.

    f) uptime - sounds good

    Thanks for your suggestions and ideas. Very useful. I will add some of them.

     
    • David Braun

      David Braun - 2015-07-15

      Sorry about the mix-up! I used the wrong email.

       
  • Nigel Griffiths

    Nigel Griffiths - 2016-01-07
    • status: open --> closed
     

Log in to post a comment.