17 Commits (c93971748cb4771aec25aee6e8ff5b7bbb1aacf3)

Author SHA1 Message Date
Aaron Marcher acfa1f50c2 Simplify format specifiers for uintmax_t 8 years ago
Aaron Marcher 43a12832a3 Change uint64_t to uintmax_t 8 years ago
Aaron Marcher 825f637e20 netspeeds: Fix indentation 8 years ago
Aaron Marcher cbbf59fd3d Change to fmt_human in netspeeds on OpenBSD
Thanks to Hiltjo
8 years ago
Aaron Marcher 10dbc9543e Merge fmt_human_2 and fmt_human_10 to one function
Now only one function, fmt_human, takes an additional argument "base".
8 years ago
Aaron Marcher ec5c35ec9f Remove units from numbers
This is a first step to decouple formatting from information because of
two reasons:

 1. The components should only gather and return the values by design
 2. Fine grained user control should be a focus

Scaling will be implemented in a different way in a later commit.
8 years ago
Aaron Marcher 3f45a5f7ca Remove initialization to 0 for static vars 8 years ago
Laslo Hunhold 46c4540dd2 Implement fmt_human_2() and fmt_human_10()
These functions take the raw number and a unit and automatically
print it out "scaled down" to a proper SI-prefix, for powers of 2
and 10 respectively.

Apply them to the 2-power cases and keep the 10-power for a later
commit.
8 years ago
Laslo Hunhold 68a3902dc5 Increase precision in netspeeds.c
First dividing by interval before multiplying with 1000 decreases the
precision by +-(interval - 1) * 1000, as interval arithmetic always
applies the Gauß-function to the result.

This is not necessary and simply reordering the operations mitigates
this.
8 years ago
Laslo Hunhold 422cadfd5f Implement esnprintf() and make formatted calls more efficient
Within the components, snprintf() was unchecked and had inefficient
calls in some places.
We implement esnprintf() that does all the dirty laundry for us
and use it exclusively now.
8 years ago
Aaron Marcher d47d78255e Use `int` for flags 8 years ago
Aaron Marcher 06d4447f03 Set {r,t}xbytes 0 before incrementing them on OBSD 8 years ago
Aaron Marcher a37224bf7b Missing assignment for last commit 8 years ago
Aaron Marcher e3ccac3298 Unify and simplify netspeed logic and types 8 years ago
Tobias Tschinkowitz 2321aecff0 netspeeds: added error condition for openbsd
implemented additional error condition for openbsd netstat in case the
interface could not be found in the interface list or if_data is not
readable.
8 years ago
Tobias Tschinkowitz 22175f0d57 implemented openbsd netspeed functions
implemented the netspeed functionality for openbsd.
furthermore the static keyword was removed of the interval variable in
config.def.h for usage as extern variable.
8 years ago
Aaron Marcher 0d05b3d13d Add network speed functions 8 years ago