Commit Graph

2561 Commits

Author SHA1 Message Date
Hisham 820c079b14 Initialize default meter modes properly. 2016-02-02 16:15:07 +01:00
Hisham f87462d60e Exit on failure! 2016-02-02 16:03:00 +01:00
Hisham b2c2b2bfb3 Merge branch 'reuse-comm' 2016-02-02 15:58:50 +01:00
Hisham ffcf48fb74 Merge branch 'xalloc' 2016-02-02 15:58:45 +01:00
Hisham 1cfcc42a8f Reuse comm object if possible, avoid useless repetitions of free+strdup. 2016-02-02 15:56:52 +01:00
Hisham b54d2dde40 Check for failure in allocations. 2016-02-02 15:53:02 +01:00
Hisham 301c346c85 Update generated headers. 2016-02-02 12:11:41 +01:00
Hisham 21da044fb4 Add generated header. 2016-01-31 17:41:55 +01:00
Hisham 6434db5b6b Differentiate threads by default. 2016-01-31 12:07:48 +01:00
Hisham a1f7f2869e Add allocation tests 2016-01-31 12:01:48 +01:00
Hisham Muhammad dcfcae1ed4 Merge pull request #351 from Explorer09/graph-height
GRAPH_HEIGHT macro and 'dot' variable
2016-01-21 10:43:44 -02:00
Explorer09 040613db33 Change variable 'dot' to avoid division by reciprocal.
(Cherry-picked from d56bcd8e0d8d6a177fc2e40db32fc73ea4588684, the
experimental graph coloring branch)

The variable 'dot' in GraphMeterMode_draw now means "maximum number of
dots per value (column) in graph". The old meaning was "amount of value
that is to be represented by a dot" and was always a fraction. Due to
a limitation in floating point computing, if GRAPH_HEIGHT were not a
power of 2, then rounding errors will occur on numbers like (1.0/3).
(Currently GRAPH_HEIGHT is 4 and so no precision loss.) 'dot' was used
as a divisor, and it's "division by a reciprocal". We change that to
simple multiplication.
2016-01-21 14:06:11 +08:00
Explorer09 d54ab24d97 New macro GRAPH_HEIGHT for Graph Meter height
(Cherry-picked from e93028d7fa0c5f00b5dc3336fd28abaf905cd572, the
experimental graph coloring branch)

Currently GRAPH_HEIGHT=4 . This prevents hard-coding the height of the graph
meters, and allows user to change it at compile-time.
2016-01-21 10:11:54 +08:00
Hisham Muhammad 09cf369f2b Merge pull request #349 from Explorer09/clamp-macro
Introduce CLAMP macro. Unify all MAX(l,MIN(h,x)) uses.
2016-01-20 19:31:52 -02:00
Explorer09 6dae8108f8 Introduce CLAMP macro. Unify all MIN(MAX(a,b),c) uses.
With the CLAMP macro replacing the combination of MIN and MAX, we will
have at least two advantages:
1. It's more obvious semantically.
2. There are no more mixes of confusing uses like MIN(MAX(a,b),c) and
   MAX(MIN(a,b),c) and MIN(a,MAX(b,c)) appearing everywhere. We unify
   the 'clamping' with a single macro.
Note that the behavior of this CLAMP macro is different from
the combination `MAX(low,MIN(x,high))`.
* This CLAMP macro expands to two comparisons instead of three from
  MAX and MIN combination. In theory, this makes the code slightly
  smaller, in case that (low) or (high) or both are computed at
  runtime, so that compilers cannot optimize them. (The third
  comparison will matter if (low)>(high); see below.)
* CLAMP has a side effect, that if (low)>(high) it will produce weird
  results. Unlike MIN & MAX which will force either (low) or (high) to
  win. No assertion of ((low)<=(high)) is done in this macro, for now.

This CLAMP macro is implemented like described in glib
<http://developer.gnome.org/glib/stable/glib-Standard-Macros.html>
and does not handle weird uses like CLAMP(a++, low++, high--) .
2016-01-15 20:26:01 +08:00
Hisham Muhammad 195f5edbc8 Merge pull request #347 from mklein-de/darwin32+64
Darwin: replace vm_statistics64_* with vm_statistics_*
2016-01-13 21:32:43 -02:00
Michael Klein d312510223 Darwin: replace vm_statistics64_* with vm_statistics_*
Works with:
- Darwin 9.8.0 (OS X 10.5.8) PPC
- Darwin 15.2.0 (OS X 10.11.2) Intel
2016-01-13 20:57:29 +01:00
Hisham Muhammad 9c39422c71 Merge pull request #346 from mklein-de/vikeys
vi keys: translate ALT-h/j/k/l to arrow keys
2016-01-13 14:20:33 -02:00
Michael Klein 99b947058f vi keys: translate ALT-h/j/k/l to arrow keys 2016-01-12 21:15:04 +01:00
Hisham Muhammad 466d4da0c6 refactor *Screen classes, add InfoScreen superclass 2016-01-12 06:00:58 -02:00
Hisham Muhammad faf2860669 Merge branch 'mklein-de-envscreen' 2016-01-12 02:57:58 -02:00
Hisham Muhammad 032af1577c Merge branch 'envscreen' of https://github.com/mklein-de/htop into mklein-de-envscreen 2016-01-12 02:55:43 -02:00
Hisham Muhammad d850803eb8 Merge branch 'master' of https://github.com/hishamhm/htop 2016-01-11 20:39:08 -02:00
Hisham Muhammad c6ca311d18 Present IO-Wait as a dot in monochrome. Fixes #345.
Thank you @Explorer09 for the report!
2016-01-11 20:38:10 -02:00
Hisham Muhammad fc61e25f5b Merge pull request #343 from FreedomBen/typo-priority
Fix typo: prority => priority
2016-01-06 22:00:52 -02:00
Benjamin Porter 4b29e8485f Fix typo: prority => priority 2016-01-06 13:49:49 -09:00
Michael Klein b14f89e9d4 drop privileges before reading environment 2016-01-06 22:53:14 +01:00
Michael Klein b10e54cdee Merge remote-tracking branch 'upstream/master' into envscreen 2016-01-06 22:39:57 +01:00
Hisham Muhammad fc4c9757b0 Merge pull request #315 from mklein-de/suid
add some security checks when running SUID root
2016-01-06 18:19:28 -02:00
Hisham Muhammad 82db9979b1 Merge pull request #339 from eworm-de/configure
use AC_HELP_STRING for proc dir
2016-01-06 18:15:39 -02:00
Christian Hesse 4c23a81d72 use AC_HELP_STRING for proc dir 2016-01-05 10:23:08 +01:00
Hisham Muhammad 6bc98bb227 Merge pull request #338 from mmcco/opl
Rename variable for consistency
2016-01-04 20:59:57 -02:00
Michael McConville e595f6865e Rename variable for consistency
Suggested by Hisham.
2016-01-04 16:20:51 -05:00
Hisham Muhammad 3ad2510fc2 Merge pull request #337 from eworm-de/help
align help output
2016-01-04 18:14:42 -02:00
Hisham Muhammad be6b0c2830 Merge branch 'mmcco-freebsd-free' 2016-01-04 18:09:22 -02:00
Hisham Muhammad f342a9eb83 Merge branch 'freebsd-free' of https://github.com/mmcco/htop into mmcco-freebsd-free 2016-01-04 18:08:51 -02:00
Hisham Muhammad c5b9045f18 Plug leak in FreeBSD backend, as noted by @mmcco in #334. 2016-01-04 18:04:50 -02:00
Hisham Muhammad 77cffaacf6 Merge pull request #334 from mmcco/cpu
Plug mem leak, improve CPU enumeration logic
2016-01-04 18:02:36 -02:00
Christian Hesse 9ca646acbb align help output 2016-01-04 16:02:29 +01:00
Michael McConville 61f2d674b0 Remove NULL-checks before free()
These are never necessary when using the standard library.
2016-01-03 16:59:44 -05:00
Michael McConville 198592a0f1 Plug mem leak, improve CPU enumeration logic
I think this leak may still exist in the FreeBSD port.
2016-01-03 16:56:33 -05:00
Hisham Muhammad be9edc5d43 Merge branch 'master' of https://github.com/hishamhm/htop 2016-01-03 16:32:48 -02:00
Hisham Muhammad 70cd5c2b88 Check range when accessing keys table.
Should fix #321.
2016-01-03 16:31:44 -02:00
Hisham Muhammad 86954f9204 Merge pull request #331 from mmcco/fixes
OpenBSD fixes and updates
2016-01-03 16:17:31 -02:00
Hisham Muhammad fe83bc8e68 Merge pull request #332 from mmcco/maintainer
Fix spelling of "maintainer"
2016-01-03 16:12:29 -02:00
Michael McConville 918cfd54d6 Fall back to sysctl's command name, and a bugfix
This is what OpenBSD's top(1) does when the libkvm call fails, and it's
a good idea.

This commit also fixes process name construction. The space was being
written one character too far.
2016-01-02 22:05:20 -05:00
Michael McConville 3da36bbc61 Use dynamically allocated memory for process names
Even when they're constant, as is the case for zombie processes.
2016-01-02 17:11:23 -05:00
Michael McConville c1b3289219 Check for allocation failure
Pointed out by Michael Reed.
2016-01-02 12:20:40 -05:00
Michael McConville ae5c01f485 Use err() rather then errx() for sysctl()
So that we can see errno. Pointed out by Michael Reed.
2016-01-02 12:17:35 -05:00
Michael McConville 7170382706 Fix spelling of "maintainer" 2016-01-02 12:11:26 -05:00