diff options
author | Charlie Vieth <charlie.vieth@gmail.com> | 2022-02-04 11:21:13 -0500 |
---|---|---|
committer | BenBE <BenBE@geshi.org> | 2022-02-18 09:07:41 +0100 |
commit | d35db47c9ad7bfe02c319b39c573c20fa823d387 (patch) | |
tree | b32220207bae2e32250682138f57b0be41d283ca /darwin/DarwinProcess.h | |
parent | 978a7c894f12c58e544860aae530f84adfed8d39 (diff) |
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.
Diffstat (limited to 'darwin/DarwinProcess.h')
-rw-r--r-- | darwin/DarwinProcess.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/darwin/DarwinProcess.h b/darwin/DarwinProcess.h index b4b86fdb..bd179746 100644 --- a/darwin/DarwinProcess.h +++ b/darwin/DarwinProcess.h @@ -13,6 +13,8 @@ in the source distribution for its full text. #include "darwin/DarwinProcessList.h" +#define PROCESS_FLAG_TTY 0x00000100 + typedef struct DarwinProcess_ { Process super; |