Commit Graph

45 Commits

Author SHA1 Message Date
Nathan Scott 61ef1134d9 Move generic (shared) code into its own sub-directory
Code that is shared across some (but not all) platforms
is moved into a 'generic' home. Makefile.am cleanups to
match plus some minor alphabetic reordering/formatting.

As discussed in https://github.com/htop-dev/htop/pull/553
2021-03-04 13:40:59 +11:00
Christian Göttsche d800d7a3ce Drop usage of formatted error messages from <err.h>
They do not clean up the ncurses environment, leaving the terminal in a
broken state.

Also drop bare usage of exit(3).
2021-01-07 16:10:05 +01:00
Luke Groeninger a150a81669 Fix CPU percentage on M1 silicon Macs 2021-01-02 22:33:20 +01:00
Christian Göttsche f878f302ca Remove duplicate newline in CRT_fatalError calls 2020-12-19 21:30:39 +01:00
Alexander Momchilov 67ccd6b909 Unhardcode tick-to-ms conversion
Division by 100000.0 worked because `sysconf(_SC_CLK_TCK)` happened to be 100.

By unhardcoding:

1) It becomes more clear what this 100000.0 figure comes from.
2) It protects against bugs in the case `sysconf(_SC_CLK_TCK)` ever changes.
2020-12-19 21:30:39 +01:00
Dániel Bakai 3655b6ca0b Add column in darwin to indicate whether the the process is running under translation 2020-12-13 17:58:16 +01:00
Christian Göttsche 72df930241 DarwinProcessList: retry getting list of all processes on ENOMEM
The process count might change between the two sysctl() calls getting
the size and getting the data.

Retry (3 times) in case the data-retrieval sysctl() call fails with ENOMEM.

see http://mirror.informatimago.com/next/developer.apple.com/qa/qa2001/qa1123.html

Related: #118
2020-11-23 17:00:32 +01:00
Christian Göttsche e3af8d0d08 DarwinProcessList: mark local functions static and sort includes 2020-11-17 21:50:38 +01:00
Benny Baumann 45869513bf Embracing branches 2020-11-02 22:15:01 +01:00
Benny Baumann 61e14d4bb2 Spacing around operators 2020-11-02 22:15:01 +01:00
Benny Baumann b23f8235e2 Whitespace and indentation issues 2020-11-02 22:15:01 +01:00
Benny Baumann adf797c295 Spacing after keywords (for) 2020-11-02 22:15:01 +01:00
Benny Baumann 374edb9ed5 Spacing after keywords (if) 2020-11-02 22:14:59 +01:00
Christian Göttsche 4eb443926f Hold only a const version of Settings in Process 2020-10-26 19:30:38 +01:00
Christian Göttsche f8208f2173 Drop tabs in source indentions 2020-10-20 21:43:36 +02:00
Christian Göttsche 96e2a4259e Continue to update generic data in paused mode
Generic data, as CPU and memory usage, are used by Meters.
In paused mode they would stop receiving updates and especially Graph
Meters would stop showing continuous data.

Improves: #214
Closes: #253
2020-10-19 14:45:39 +02:00
Christian Göttsche a63cfc8b7c Refactor generating starttime string into Process class 2020-10-16 19:23:40 +02:00
Daniel Lange 079c2abf8e Update License consistently to GPLv2 as per COPYING file 2020-10-05 10:13:12 +02:00
Christian Göttsche efb971f9df Fail travis CI on compiler warnings 2020-09-18 12:28:40 +02:00
Nathan Scott 4597332959 Switch variable/field naming from WhiteList to MatchList 2020-09-09 19:38:15 +10:00
Zev Weiss a1a027b9bd Axe automated header generation.
Reasoning:
 - implementation was unsound -- broke down when I added a fairly
   basic macro definition expanding to a struct initializer in a *.c
   file.

 - made it way too easy (e.g. via otherwise totally innocuous git
   commands) to end up with timestamps such that it always ran
   MakeHeader.py but never used its output, leading to overbuild noise
   when running what should be a null 'make'.

 - but mostly: it's just an awkward way of dealing with C code.
2020-09-03 11:58:58 -05:00
Ross Williams e450b58636 Refactor openzfs_sysctl_init() and ZfsArcMeter...
openzfs_sysctl_init() now returns void instead of int.
The ZfsArcStats->enabled flag is set inside the init function
now, instead of having to be set from its return value.
Preparation for more flag setting in Compressed ARC commit.

ZfsArcMeter_readStats() added and all Meter->values[] setting
moved to it, eliminating duplicated code in
{darwin,freebsd,linux,solaris}/Platform.c.
2019-09-03 18:21:33 +00:00
Ross Williams a88d2e313d Refactor common OpenZFS sysctl access
Darwin and FreeBSD export zfs kstats through the
same APIs, so moving functions into a common file.
2019-07-07 23:10:54 -04:00
Ross Williams fc8e9a2d3e ZFS arcstats for Darwin (macOS / OS X) 2019-07-07 23:10:46 -04:00
Alan Barr 60e557868a Prevent possible NULL pointer deference
Raised by cppcheck
2019-02-10 14:16:46 +01:00
pmalhaire 0505a7cfe1 macOS: fix the switched version test (#772) 2018-04-05 19:41:22 -03:00
pmalhaire 23f96048c7 macOS: keep scanning thread for versions before High Sierra (#728)
Keep scanning threads for versions before High Sierra 13.0.0 and after 13.3.0.
2018-03-26 15:14:12 -03:00
Hisham Muhammad b27712181a Darwin: disable thread reading due to bug in macOS High Sierra 2018-02-04 08:59:29 +01:00
Hisham Muhammad 5ee6715843 Scan threads for process state information.
Based on: http://stackoverflow.com/questions/6788274/ios-mac-cpu-usage-for-thread
and       e86692e869/ProcessList.c
This should be a fix for #361.
2016-02-18 14:57:09 -02:00
Hisham b54d2dde40 Check for failure in allocations. 2016-02-02 15:53:02 +01: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 5e0f1788e6 Fix CRT_fatalError warning. 2015-11-02 10:22:10 -05:00
Hisham Muhammad fd5dd6605a Merge pull request #299 from mmcco/master
OpenBSD port updates and error exit improvements
2015-11-02 08:46:40 -05:00
Michael McConville cd3d2337f8 Replace all err.h function uses with CRT_fatalError(). Failing with
err.h functions corrupts the terminal when using curses.
2015-11-01 13:26:57 -05:00
Hisham Muhammad bd93b2e1d7 Initialize variables, silence warnings. 2015-10-24 23:28:29 -04:00
Hisham Muhammad bf276a0993 Merge pull request #274 from mmcco/master
Cleanup and initial OpenBSD support
2015-10-05 11:22:50 -03:00
Michael McConville 571cbc0aa1 Change more fprintf(stderr, ...); exit(...); to err[x](...). Tweak a few existing ones and fix some style. 2015-09-19 12:15:26 -04:00
Michael McConville 445222e48c Clean up some needless malloc casts, convert some mallocs to callocs, and fix some style 2015-09-16 23:42:36 -04:00
kaefer 40525d85bc removing unnecessary include, which on top breaks compiling 2015-09-14 16:18:51 +02:00
David Hunt 907f8298a0 CPU per process implemented 2015-08-19 13:52:57 -03:00
David Hunt 57ab332d5a Fix the thread counts 2015-08-19 13:52:38 -03:00
David Hunt 6463ea2956 Fixed CPU updating 2015-08-19 13:52:18 -03:00
David Hunt 7f3faa276a Static CPU meter 2015-08-19 13:52:04 -03:00
David Hunt 43ef703f03 Start supporting actual data 2015-08-19 13:51:49 -03:00
David Hunt 70e7c8db59 Added darwin with working battery meter 2015-08-19 13:47:26 -03:00