htop/CRT.h

188 lines
3.2 KiB
C
Raw Normal View History

2006-03-04 18:16:49 +00:00
#ifndef HEADER_CRT
#define HEADER_CRT
/*
htop - CRT.h
2011-05-26 16:35:07 +00:00
(C) 2004-2011 Hisham H. Muhammad
Released under the GNU GPLv2, see the COPYING file
2006-03-04 18:16:49 +00:00
in the source distribution for its full text.
*/
#include "config.h"
#include <stdbool.h>
#include "Macros.h"
#include "ProvideCurses.h"
2021-01-27 16:14:15 +00:00
#include "Settings.h"
typedef enum TreeStr_ {
TREE_STR_VERT,
TREE_STR_RTEE,
TREE_STR_BEND,
TREE_STR_TEND,
TREE_STR_OPEN,
TREE_STR_SHUT,
TREE_STR_ASC,
TREE_STR_DESC,
2020-12-14 14:45:48 +00:00
LAST_TREE_STR
} TreeStr;
2020-12-14 14:45:48 +00:00
typedef enum ColorScheme_ {
COLORSCHEME_DEFAULT,
2020-10-05 15:24:59 +00:00
COLORSCHEME_MONOCHROME,
COLORSCHEME_BLACKONWHITE,
COLORSCHEME_LIGHTTERMINAL,
COLORSCHEME_MIDNIGHT,
COLORSCHEME_BLACKNIGHT,
COLORSCHEME_BROKENGRAY,
2020-12-14 14:45:48 +00:00
LAST_COLORSCHEME
} ColorScheme;
2006-03-04 18:16:49 +00:00
typedef enum ColorElements_ {
RESET_COLOR,
DEFAULT_COLOR,
FUNCTION_BAR,
FUNCTION_KEY,
FAILED_SEARCH,
2020-10-17 10:54:45 +00:00
FAILED_READ,
2020-10-05 13:14:54 +00:00
PAUSED,
2006-03-04 18:16:49 +00:00
PANEL_HEADER_FOCUS,
PANEL_HEADER_UNFOCUS,
PANEL_SELECTION_FOCUS,
PANEL_SELECTION_FOLLOW,
PANEL_SELECTION_UNFOCUS,
2006-03-04 18:16:49 +00:00
LARGE_NUMBER,
METER_SHADOW,
2006-03-04 18:16:49 +00:00
METER_TEXT,
METER_VALUE,
METER_VALUE_ERROR,
2020-10-16 17:44:53 +00:00
METER_VALUE_IOREAD,
METER_VALUE_IOWRITE,
2020-10-07 13:42:13 +00:00
METER_VALUE_NOTICE,
METER_VALUE_OK,
METER_VALUE_WARN,
2006-03-04 18:16:49 +00:00
LED_COLOR,
UPTIME,
BATTERY,
2006-03-04 18:16:49 +00:00
TASKS_RUNNING,
SWAP,
SWAP_CACHE,
2006-03-04 18:16:49 +00:00
PROCESS,
PROCESS_SHADOW,
PROCESS_TAG,
PROCESS_MEGABYTES,
PROCESS_GIGABYTES,
2006-03-04 18:16:49 +00:00
PROCESS_TREE,
PROCESS_R_STATE,
2014-10-14 01:30:17 +00:00
PROCESS_D_STATE,
2006-03-04 18:16:49 +00:00
PROCESS_BASENAME,
PROCESS_HIGH_PRIORITY,
PROCESS_LOW_PRIORITY,
2020-10-31 01:56:16 +00:00
PROCESS_NEW,
PROCESS_TOMB,
PROCESS_THREAD,
PROCESS_THREAD_BASENAME,
2020-10-17 10:54:45 +00:00
PROCESS_COMM,
PROCESS_THREAD_COMM,
2006-03-04 18:16:49 +00:00
BAR_BORDER,
BAR_SHADOW,
GRAPH_1,
GRAPH_2,
MEMORY_USED,
MEMORY_BUFFERS,
MEMORY_BUFFERS_TEXT,
2006-03-04 18:16:49 +00:00
MEMORY_CACHE,
MEMORY_SHARED,
HUGEPAGE_1,
HUGEPAGE_2,
HUGEPAGE_3,
HUGEPAGE_4,
2006-03-04 18:16:49 +00:00
LOAD,
LOAD_AVERAGE_FIFTEEN,
LOAD_AVERAGE_FIVE,
LOAD_AVERAGE_ONE,
CHECK_BOX,
2006-03-04 18:16:49 +00:00
CHECK_MARK,
CHECK_TEXT,
CLOCK,
DATE,
DATETIME,
HELP_BOLD,
HELP_SHADOW,
HOSTNAME,
2006-03-04 18:16:49 +00:00
CPU_NICE,
CPU_NICE_TEXT,
2006-03-04 18:16:49 +00:00
CPU_NORMAL,
2020-08-20 04:09:27 +00:00
CPU_SYSTEM,
CPU_IOWAIT,
CPU_IRQ,
CPU_SOFTIRQ,
CPU_STEAL,
CPU_GUEST,
2020-08-20 03:59:41 +00:00
PRESSURE_STALL_TEN,
PRESSURE_STALL_SIXTY,
PRESSURE_STALL_THREEHUNDRED,
ZFS_MFU,
ZFS_MRU,
ZFS_ANON,
ZFS_HEADER,
ZFS_OTHER,
ZFS_COMPRESSED,
ZFS_RATIO,
2020-09-22 11:54:15 +00:00
ZRAM,
Add a new DynamicMeter class for runtime Meter extension This commit is based on exploratory work by Sohaib Mohamed. The end goal is two-fold - to support addition of Meters we build via configuration files for both the PCP platform and for scripts ( https://github.com/htop-dev/htop/issues/526 ) Here, we focus on generic code and the PCP support. A new class DynamicMeter is introduced - it uses the special case 'param' field handling that previously was used only by the CPUMeter, such that every runtime-configured Meter is given a unique identifier. Unlike with the CPUMeter this is used internally only. When reading/writing to htoprc instead of CPU(N) - where N is an integer param (CPU number) - we use the string name for each meter. For example, if we have a configuration for a DynamicMeter for some Redis metrics, we might read and write "Dynamic(redis)". This identifier is subsequently matched (back) up to the configuration file so we're able to re-create arbitrary user configurations. The PCP platform configuration file format is fairly simple. We expand configs from several directories, including the users homedir alongside htoprc (below htop/meters/) and also /etc/pcp/htop/meters. The format will be described via a new pcp-htop(5) man page, but its basically ini-style and each Meter has one or more metric expressions associated, as well as specifications for labels, color and so on via a dot separated notation for individual metrics within the Meter. A few initial sample configuration files are provided below ./pcp/meters that give the general idea. The PCP "derived" metric specification - see pmRegisterDerived(3) - is used as the syntax for specifying metrics in PCP DynamicMeters.
2021-06-23 07:44:56 +00:00
DYNAMIC_GRAY,
DYNAMIC_DARKGRAY,
DYNAMIC_RED,
DYNAMIC_GREEN,
DYNAMIC_BLUE,
DYNAMIC_CYAN,
DYNAMIC_MAGENTA,
DYNAMIC_YELLOW,
DYNAMIC_WHITE,
2006-03-04 18:16:49 +00:00
LAST_COLORELEMENT
} ColorElements;
void CRT_fatalError(const char* note) ATTR_NORETURN;
2014-04-24 15:20:03 +00:00
void CRT_handleSIGSEGV(int signal) ATTR_NORETURN;
2020-10-05 15:24:59 +00:00
#define KEY_WHEELUP KEY_F(20)
#define KEY_WHEELDOWN KEY_F(21)
#define KEY_RECLICK KEY_F(22)
#define KEY_ALT(x) (KEY_F(64 - 26) + ((x) - 'A'))
extern const char* CRT_degreeSign;
2006-03-04 18:16:49 +00:00
#ifdef HAVE_LIBNCURSESW
extern bool CRT_utf8;
#endif
2020-10-31 22:28:02 +00:00
extern const char* const* CRT_treeStr;
2006-06-06 20:28:42 +00:00
2020-10-05 15:24:59 +00:00
extern const int* CRT_colors;
extern int CRT_cursorX;
2014-02-27 19:35:22 +00:00
extern int CRT_scrollHAmount;
extern int CRT_scrollWheelVAmount;
2020-12-14 14:45:48 +00:00
extern ColorScheme CRT_colorScheme;
2021-01-27 16:14:15 +00:00
void CRT_init(const Settings* settings, bool allowUnicode);
2006-03-04 18:16:49 +00:00
void CRT_done(void);
2006-03-04 18:16:49 +00:00
int CRT_readKey(void);
2006-03-04 18:16:49 +00:00
void CRT_disableDelay(void);
2006-06-06 20:28:42 +00:00
void CRT_enableDelay(void);
2006-06-06 20:28:42 +00:00
void CRT_setColors(int colorScheme);
2006-03-04 18:16:49 +00:00
#endif