Commit Graph

20 Commits

Author SHA1 Message Date
Matt McCormick
42275e094d Memory mode output for platforms other than osx.
Refactor status string generation into a common function.
2016-02-14 23:47:02 -05:00
Matt McCormick
4fd854ce16 Give the MEMORY_MODE enum a name.
This improves readability. Also, set the default value in one place in the
declaration.
2016-02-10 16:47:29 -05:00
Matt McCormick
c5f369ae00 Fix trailing whitespace in linux/memory.cc. 2016-02-10 16:41:36 -05:00
cousine
0e89998ee4 Add new mode to other platforms and indicate mac only support in README 2016-02-10 17:38:11 +02:00
Pawel "l0ner" Soltys
87cc9b1ce8 Code Refactoring part 2: unified load_string() function on all platforms
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.
2015-02-19 21:26:35 +01:00
Pawel "l0ner" Soltys
240752d800 Code Refactornig
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.
2015-02-19 19:47:45 +01:00
Matt McCormick
9498e06ac4 Collect top level code files into common directory.
A little more organized.
2015-01-20 08:04:02 -05:00
Pawel "l0ner" Soltys
2fb24571ef use inline function for unit conversion instead of macros 2015-01-18 20:02:46 +01:00
Pawel "l0ner" Soltys
7c883b924a restore parsing of /proc/meminfo to get memory usage
See issue:
e7f2dd25e8 (commitcomment-9327932)

Unfortunately we can't pull info about cached memory from sysinfo.
Thus we need stick to /proc/meminfo parsing. See code for more comments.
2015-01-18 19:20:55 +01:00
Pawel "l0ner" Soltys
d3eb9e3187 use macros from config.h to calculate megabyes
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.
2015-01-18 17:21:19 +01:00
Pawel "l0ner" Soltys
51f85ba032 code syntax style, vim modelines, license
* 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.
2015-01-18 14:36:59 +01:00
Pawel "l0ner" Soltys
7151b70c70 Fixed typos in linux/load.cc 2015-01-17 16:23:55 +01:00
Pawel "l0ner" Soltys
d692eeaf93 added missing include "load.h" 2015-01-12 15:58:31 +01:00
Pawel "l0ner" Soltys
220d260673 use sysinfo() to get load avg instead of parsing /proc/ file 2015-01-10 17:27:54 +01:00
Pawel "l0ner" Soltys
e7f2dd25e8 use sysinfo() to get ram stats instead of parsing meminfo file.
Idea pulled from seculabird gihub user.
see:
880f8b1967
2015-01-09 14:52:50 +01:00
Pawel "l0ner" Soltys
b02d0000e9 pulled Joe136 solution to MemAvailable being present in /proc/meminfo
on some systems
2015-01-09 14:10:26 +01:00
l0ner
634201aa2c fixed typos in graph.{cc,h} and linux/cpu.h 2014-04-19 22:25:53 +00:00
l0ner
b0ab6ea57a cpu.cc - fixed missing header and variable misname 2014-04-14 20:57:00 +02:00
l0ner
5e354b9221 memory.cc - fixed typos and missing headers 2014-04-14 20:55:00 +02:00
l0ner
fed7b88ccd .gitignore add
Version generation by cmake
system type detection in cmake
Split file code for better management
2014-04-14 20:47:51 +02:00