Menu

#9 Wrong traffic rate unit displayed in low traffic interfaces

open
5
2007-06-21
2007-06-20
No

When monitoring a low traffic interface (< 1KB/s) on the "Interface statistics" page, the chart display still uses "kB" as the traffic rate unit, despite the fact that it is actually means bytes per second.

I've made a quick fix to graph.py, in the LoadGraph::__text_size() operation. But that shouldn't be proper.

def __text_size(self):
""" Computes the size of the text and thus the left border """
val = self.maxval / self.__config.get_metric()
# hacked by Martin Kou
if self.maxval < 1024:
self.__config["data_metric"] = "B";
else:
self.__config["data_metric"] = "kB";
if val == 0 and self.maxval != 0:
val = self.maxval

self.__str_max = "%d %s" % (val, self.__config["data_metric"])
self.__str_mid = "%d %s" % (val/2, self.__config["data_metric"])
LoadGraph.padding["left"] = self.__context.text_extents(self.__str_max)[2] + 10

Discussion

  • Jakub Hrozek

    Jakub Hrozek - 2007-06-21
    • assigned_to: nobody --> jhrozek
     
  • Jakub Hrozek

    Jakub Hrozek - 2007-06-21

    Logged In: YES
    user_id=1709697
    Originator: NO

    Thank you for submitting this bug report!

    I was actually thinking about treating all traffic < 1 kB as 0...but I'll look into incorporating this new stuff into the existing codebase later today.

    Keep tuned :-)

     
  • Nobody/Anonymous

    Logged In: NO

    Martin,
    from my quick testing, it seems that your patch indeed works fine, committed in r. 125:

    Thanks for your contribution!

    Jakub

    ----------------------------

    [jakub@rincewin] gnm $ svn diff -r 124
    Index: graph.py
    ===================================================================
    --- graph.py (revision 124)
    +++ graph.py (working copy)
    @@ -150,6 +150,11 @@
    def __text_size(self):
    """ Computes the size of the text and thus the left border """
    val = self.maxval / self.__config.get_metric()
    + # hacked by Martin Kou
    + if self.maxval < 1024:
    + self.__config["data_metric"] = "B";
    + else:
    + self.__config["data_metric"] = "kB";
    if val == 0 and self.maxval != 0:
    val = self.maxval

    Index: gnm.py

    --- gnm.py (revision 124)
    +++ gnm.py (working copy)
    @@ -125,7 +125,7 @@
    "1.0",
    "Copyright (c) 2007 Jakub Hrozek",
    "A network monitor for the GNOME desktop",
    - [ "Jakub Hrozek (jhrozek@redhat.com)" ])
    + [ "Jakub Hrozek (jhrozek@redhat.com)", "Martin Kou (fix for SF ticket #1740639)" ])
    about_dlg.show()

    def run():

     

Log in to post a comment.