Commit Graph

28 Commits

Author SHA1 Message Date
Charlie Vieth
d35db47c9a darwin: lazily set process TTY name
Fetching the TTY name of a process is extremely expensive on darwin and
the call to devname accounts for 95% of htop's CPU usage when there is
high process turnover (this is mostly due to devname calling lstat,
which is incredibly slow). This can make htop unresponsive.

To mitigate this only set the process TTY name if the it is being
actively displayed (PROCESS_FLAG_TTY), which by default it is not
on darwin.
2022-02-18 09:07:41 +01:00
Alexander Momchilov
dadcb87ad0 Extract Darwin "PlatformHelpers" 2021-09-26 10:58:47 -04:00
Daniel Lange
94ad111391 Update license headers to explicitly say GPLv2+ 2021-09-22 14:28:19 +02:00
Alexander Momchilov
7a4d6fa409 Style touch-ups 2021-08-23 10:37:49 -04:00
Alexander Momchilov
5b4d63d1be Fix macOS CPU time calculations 2021-08-23 10:37:49 -04:00
Benny Baumann
7224d0e083 Move kernel/userland thread handling to platform-independent implementation 2021-05-23 09:22:21 +02:00
mayurdahibhate
3f86a011e6 platform-dependent files included relative to main source directory 2021-05-10 18:40:53 +02: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
Christian Göttsche
9f68c8d341 Merge Process_pidColumns into Process_fields and rework auto-fit for PID-like columns 2020-12-19 21:13:32 +01:00
Christian Göttsche
89473cc9ae Rework enum ProcessField
Use only one enum instead of a global and a platform specific one.
Drop Platform_numberOfFields global variable.
Set known size of Process_fields array
2020-12-19 21:13:32 +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
Dániel Bakai
1506283aff Move Process_fields from darwin/Platform to darwin/DarwinProcess 2020-12-13 17:58:16 +01:00
Christian Göttsche
ba2d59020d DarwinProcess: mark local function static and sort includes 2020-11-17 21:50:38 +01:00
Benny Baumann
61e14d4bb2 Spacing around operators 2020-11-02 22:15:01 +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
a63cfc8b7c Refactor generating starttime string into Process class 2020-10-16 19:23:40 +02:00
Christian Göttsche
7af06659e2 Mark remaining classes const 2020-10-13 14:56:01 +02:00
Christian Göttsche
41eea8a355 Mark process argument of Process_isThread const 2020-10-09 10:18:40 +02:00
Daniel Lange
079c2abf8e Update License consistently to GPLv2 as per COPYING file 2020-10-05 10:13:12 +02:00
Nathan Scott
8ec5d4a3a0 Further, minor cleanups to headers post-MakeHeaders
Remove leftover empty ifdef/endif pairs, whitespace.
The generated htop.h file was also unused - removed.
2020-09-08 17:33:50 +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
Hisham
306c5443ae Update header. 2016-03-31 11:01:23 -03:00
Hisham Muhammad
42c4459375 Run through all command line arguments on Darwin.
Also fixes the basename offset for highlighting the basename.
Closes #379.
2016-02-18 23:45:17 -02: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
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
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