Commit Graph

17 Commits

Author SHA1 Message Date
WuYiyang
d34821cb95 uint32_t get_cpu_count() : support >255 threads 2020-02-23 02:40:10 +00:00
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
7eef3670e0 Fix whitespace in osx/memory.cc. 2016-02-10 16:48:37 -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
cousine
635334b141 Adhere to the styling guide, added enum for memory modes, refractored memory mode if block to use switch instead and added test cases for free memory and user percentage memory modes 2016-02-10 22:49:49 +02:00
cousine
451aed4530 added memory mode to calculate %, and free memory 2016-02-10 17:32:01 +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
Pawel "l0ner" Soltys
33d64bc53b OSX: exclude cached memory from used 2015-02-15 01:17:51 +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
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
f073450edd OSX: removed useless includes 2015-01-12 15:57:41 +01:00
Pawel "l0ner" Soltys
7a9209e243 grime removal: useless includes and code 2015-01-04 18:51:43 +01:00
Pawel "l0ner" Soltys
47b9f62a10 include fixes to make it compile on osx, added *~ files to gitignore 2015-01-04 17:21:20 +01: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