Age | Commit message (Collapse) | Author |
|
We should make better split os specify code for FreeBSD and Linux.
Idea comes from @liskin.
|
|
In freebsd /sys/class/net is absent so we should use sysctl for
obtaining info about stats of network.
For parsing if_data struct we could use a "Foreign.Storable"
|
|
|
|
|
|
|
|
- use strict ByteString as the Lazy version of readFile allocates a 32k
buffer even though we usually need much less (isUp needs a few bytes)
- refactor NetDev datatype and use unsafeInterleaveIO in isUp to avoid
reading the operstate file entirely if we're not interested in that
device
- postpone ByteString unpacking in netParser to shave off some cycles,
and avoid ByteString unpacking in isUp entirely
On my system with 8 network devices (and more if docker is up), this
seems to reduce xmobar's CPU usage noticeably. I have two "Run Network"
in xmobar configuration, for eth and wlan, so without these changes,
xmobar would evaluate isUp 16 times a second, and each evaluation would
allocate a buffer for the IO Handle and then another buffer for the lazy
ByteString readFile. Now it only does isUp once for every device I'm
interested in, and the only large buffers allocated are the IO Handle
ones (getting rid of these isn't worth the code complexity).
|
|
* add filtering option for Net devices
* relate to comments
* upd readme
* add few more words to readme
|
|
|
|
|
|
Move the Main module to a new `app` directory. All other modules have
been nested under the `Xmobar` name. Lots of module headers & imports
were updated.
|