unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ken Hori <fplemma@gmail.com>
To: Vicente Hernando Ara <bizenton@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Showing network speed in emacs mode line.
Date: Tue, 19 Jan 2010 17:34:11 -0800	[thread overview]
Message-ID: <d0dc7c8f1001191734q26613c1djb6dd24960337a1b@mail.gmail.com> (raw)
In-Reply-To: <72c70c081001191631g22ab8dadga39cecf967276af7@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3031 bytes --]

I don't have time to dig into it, but to give you a clue, the target line in
/proc/net/dev is:

  eth0:3819769008 3075291    0    0    0     0          0         0
1353810812 2234060    0    0    0     0       0          0

(network-speed-get-rx-tx-bytes)
=> (["eth0" 3819769008 1353810812 0.0 0.0])

I don't think the last two numbers are correct.


On Tue, Jan 19, 2010 at 4:31 PM, Vicente Hernando Ara <bizenton@gmail.com>wrote:

> Hi Ken,
>
> this elisp program parses /proc/net/dev file searching for the line
> containing the interface you selected. Then it gets first and ninth
> numbers (for received and transmitted bytes) and performs a
> subtraction and a division to calculate speed)
>
> I would check that /proc/net/dev file to know if it changes adequately
> when you are online.
>
> I this gives us no clue I would add a (message "hello") to
> network-speed-update-handler and network-speed-get-rx-tx-bytes
> functions. network-speed-update-handler is the function called every
> network-speed-update-interval seconds and
> network-speed-get-rx-tx-bytes parses the file and store values in a
> list of vectors.
>
>
>
> On 20/01/2010, Ken Hori <fplemma@gmail.com> wrote:
> > interesting elisp. but the only thing that gets appended to modeline is
> >
> > [eth0 rx:0 B/s tx:0 B/s]
> >
> > there is no change whatsoever even though i am online (otherwise you
> wouldnt
> > receive this email).
> >
> >
> > On Tue, Jan 19, 2010 at 3:00 PM, Vicente Hernando Ara
> > <bizenton@gmail.com>wrote:
> >
> >> Hi to all the emacs community!
> >>
> >> I have written an elisp file(attached to this mail) that shows network
> >> speed in emacs mode line.
> >>
> >> Just to make it work:
> >>
> >> M-x load-file RET /path/to/network-speed.el
> >> M-x network-speed-start
> >>
> >> and to stop it showing in the mode line
> >> M-x network-speed-stop
> >>
> >> There are several customizable variables. e.g in my .emacs file :
> >> (custom-set-variables
> >> ....
> >>  '(network-speed-update-interval 2)   ; Shows network speed every 2
> >> seconds.
> >>  '(network-speed-interface-list (list "ppp0" "eth0")))  ; Network
> >> interfaces to be shown in mode line.
> >>  '(network-speed-precision 1) ; Number of digits to be shown after
> decimal
> >> point.
> >>  '(network-speed-format-string " [%NI %AX %AB] ") ;  or i.e: "[%NI
> rx:%RX
> >> tx:%TX]"
> >>  '(network-speed-interface-list (list "ppp0" "eth0"))  ; Network
> >> interfaces
> >> to be shown in mode line.
> >>
> >> network-speed-format-string can be customized to show:
> >> %NI : network interface name
> >> %RB: received bytes
> >> %TB: transmitted bytes
> >> %AB: all received + transmitted bytes.
> >> %RX: received byte speed.
> >> %TX: transmitted byte speed.
> >> %AX: total byte speed.
> >> %%%: escape secuence for % character.
> >>
> >> I hope you test it and enjoy!
> >> Any constructive criticism is welcomed.
> >> I also would be glad about signing FSF papers for this file if it is
> >> considered worthy.
> >>
> >> Kind regards,
> >> Vicente.
> >>
> >
>

[-- Attachment #2: Type: text/html, Size: 4106 bytes --]

  reply	other threads:[~2010-01-20  1:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-19 23:00 Showing network speed in emacs mode line Vicente Hernando Ara
2010-01-20  0:09 ` Ken Hori
2010-01-20  0:31   ` Vicente Hernando Ara
2010-01-20  1:34     ` Ken Hori [this message]
2010-01-20  1:52 ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0dc7c8f1001191734q26613c1djb6dd24960337a1b@mail.gmail.com \
    --to=fplemma@gmail.com \
    --cc=bizenton@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).