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.
Since the headers for cpu, memory and load functions are virtually the same for
all platforms, I've decided to move them into common/ dir and do some
refacotring:
* removed per-platform header files
* implemented get_cpu_count() function across all platforms. We are using it cpu
on every platform, yet not on every one this was implemented as a separate
function.
* removed platform detection through preprocessor from main: we don't need this
there anymore, since the headers are common for all platforms. CMake will
handle setting of correct source files for us now.
* Unified used defines for CPU states across all platforms and made linux use
them. Added some platform detection to cpu.h in order to set them correctly
across the platforms.
* moved getsysctl.h to common/ dir, since it's used on Net and Free BSD, and
thus become a common include.
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.
* 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.