All the platforms were using identical logic based on getloadavg() function to
get the load avg stats (except linux, which was using sinfo struct, but can use getloadavg() function). I've noticed this while working on NetBSD port.
Also: fixed a typo on freebsd.
On OpenBSD 5.6 sys/ucred.h uses NGROUP define, but misses include to
sys/param.h in which NGROUP is defined. sys/ucred.h is included in
sys/mount.h which we need to get the cached ram. Because of this include
chain our compilation will fail with missing NGROUP define. This can be
resolved by including in our code (and in correct order) system headers.
- Removed OpenBSD stuff from freebsd port
- Renamed bsd folder to freebsd since now it contains only
freebsd-relevant files.
- Changed CMake instructions to account for bsd port changes
- modified main source file to account for openbsd port
instead of using hard coded divisions to calculate ram stats it's better to use
macros defined in config.h. BSD port was doing this already, using macros
defined in it's common.h header. I pulled those macros out and applied them to
all platforms.
File version.h.in got renamed into config.h.in since it doesn't caontain only
the version anymore.
2cc9efb187 (commitcomment-9327965)
Instead of checking for compiler version or whether it supports c++ features
through target_compile_features test whether compiler supports one of the c++11
flags (-std=c++11 or -std=c++0x). Cleaner and simplier code. And we can make it
fail loudly if comiler does not support c++11
now the version variables will be prefixed with 'tmux-mem-cpu-load'. This way we
won't clash with any future dependency that might redefine those variables.
This is exactly how CMake does it in their code, see:
f3e92d2816/Source/CMakeVersion.cmake6ae98ee18f/Source/cmVersionConfig.h.in6ae98ee18f/Source/CMakeVersionCompute.cmake
the only difference is that they have functions that return the versions and I
use those variables directly.
6ae98ee18f/Source/cmVersion.cxx
Since the partial version variables are not used anywhere in the code we might
as well remove them from version.h.in. I've deciced to leave them for now, since
we might need them in the future.
* Use std::sting instead of char[] in the graph drawing functions. This is the
only change to the code. Rest is just styling.
* Corrected whole code to follow Allman/GNU coding style, with 2 spaces for each
indentation step.
* Added license headers to all code files
* Added vim modelines to all files. They sit on the first line and enable the
following settings: 2 space indentation, tab expansion to spaces, line at
80th column, automatic line breaking on "\ !@*+-;:,./?" characters, automatic
line break if line exceeds 80 colums. This should keep the code nice and tidy.
This should fix problems with different flags for c++11 across different gcc
versions. Should compile on Clang and gcc >= 4.6. Lower versions of gcc are
untested. I don't even know wheteher they support c++11 (gcc 4.2.1 on OpenBSD
5.7 does not).
Add support for Mac OSX from Justastic. Refactors the code from Justastic so it
works with the Linux code and so it also works for the new colors support.
Still need to test on OSX.
Conflicts:
tmux-mem-cpu-load.cpp