2006-03-04 18:16:49 +00:00
|
|
|
#ifndef HEADER_Settings
|
|
|
|
#define HEADER_Settings
|
|
|
|
/*
|
2006-06-06 20:28:42 +00:00
|
|
|
htop - Settings.h
|
2011-05-26 16:35:07 +00:00
|
|
|
(C) 2004-2011 Hisham H. Muhammad
|
2020-10-05 09:51:32 +02:00
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2020-09-19 13:55:23 +02:00
|
|
|
#include "config.h" // IWYU pragma: keep
|
2006-04-10 20:40:38 +00:00
|
|
|
|
2011-12-26 21:35:57 +00:00
|
|
|
#include <stdbool.h>
|
2020-12-06 15:22:41 +01:00
|
|
|
#include <stdint.h>
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-18 19:23:04 +02:00
|
|
|
#include "Process.h"
|
|
|
|
|
2020-09-19 13:55:23 +02:00
|
|
|
|
|
|
|
#define DEFAULT_DELAY 15
|
|
|
|
|
2015-01-21 23:27:31 -02:00
|
|
|
typedef struct {
|
|
|
|
int len;
|
|
|
|
char** names;
|
|
|
|
int* modes;
|
|
|
|
} MeterColumnSettings;
|
2015-01-23 03:08:21 -02:00
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
typedef struct Settings_ {
|
2015-01-21 23:27:31 -02:00
|
|
|
char* filename;
|
|
|
|
MeterColumnSettings columns[2];
|
|
|
|
|
|
|
|
ProcessField* fields;
|
2020-10-09 15:13:06 +02:00
|
|
|
uint32_t flags;
|
2006-03-04 18:16:49 +00:00
|
|
|
int colorScheme;
|
2006-04-10 20:40:38 +00:00
|
|
|
int delay;
|
2015-01-21 23:27:31 -02:00
|
|
|
|
|
|
|
int direction;
|
2020-12-18 11:03:31 -03:00
|
|
|
int treeDirection;
|
2015-01-21 23:27:31 -02:00
|
|
|
ProcessField sortKey;
|
2020-12-18 11:03:31 -03:00
|
|
|
ProcessField treeSortKey;
|
2015-01-21 23:27:31 -02:00
|
|
|
|
2019-12-19 16:30:45 -06:00
|
|
|
bool countCPUsFromOne;
|
2015-01-21 23:27:31 -02:00
|
|
|
bool detailedCPUTime;
|
2019-08-10 11:20:21 -07:00
|
|
|
bool showCPUUsage;
|
2019-08-09 21:34:48 -07:00
|
|
|
bool showCPUFrequency;
|
2020-12-01 13:59:19 +01:00
|
|
|
#ifdef HAVE_SENSORS_SENSORS_H
|
2020-09-10 19:56:33 +02:00
|
|
|
bool showCPUTemperature;
|
|
|
|
bool degreeFahrenheit;
|
|
|
|
#endif
|
2015-01-21 23:27:31 -02:00
|
|
|
bool treeView;
|
2020-12-17 19:08:56 -03:00
|
|
|
bool treeViewAlwaysByPID;
|
2015-07-29 21:14:29 +02:00
|
|
|
bool showProgramPath;
|
2015-01-21 23:27:31 -02:00
|
|
|
bool shadowOtherUsers;
|
|
|
|
bool showThreadNames;
|
|
|
|
bool hideKernelThreads;
|
|
|
|
bool hideUserlandThreads;
|
|
|
|
bool highlightBaseName;
|
|
|
|
bool highlightMegabytes;
|
|
|
|
bool highlightThreads;
|
2020-10-30 21:56:16 -04:00
|
|
|
bool highlightChanges;
|
|
|
|
int highlightDelaySecs;
|
2020-10-17 16:24:45 +05:30
|
|
|
bool findCommInCmdline;
|
|
|
|
bool stripExeFromCmdline;
|
|
|
|
bool showMergedCommand;
|
2015-01-21 23:27:31 -02:00
|
|
|
bool updateProcessNames;
|
|
|
|
bool accountGuestInCPUMeter;
|
|
|
|
bool headerMargin;
|
2019-07-12 21:41:09 +02:00
|
|
|
bool enableMouse;
|
2020-08-26 10:15:00 +10:00
|
|
|
#ifdef HAVE_LIBHWLOC
|
|
|
|
bool topologyAffinity;
|
|
|
|
#endif
|
2015-01-21 23:27:31 -02:00
|
|
|
|
2014-02-27 16:35:22 -03:00
|
|
|
bool changed;
|
2006-03-04 18:16:49 +00:00
|
|
|
} Settings;
|
|
|
|
|
2019-12-19 16:30:45 -06:00
|
|
|
#define Settings_cpuId(settings, cpu) ((settings)->countCPUsFromOne ? (cpu)+1 : (cpu))
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-12-18 11:03:31 -03:00
|
|
|
static inline ProcessField Settings_getActiveSortKey(const Settings* this) {
|
|
|
|
return (this->treeView)
|
|
|
|
? (this->treeViewAlwaysByPID ? PID : this->treeSortKey)
|
|
|
|
: this->sortKey;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int Settings_getActiveDirection(const Settings* this) {
|
|
|
|
return this->treeView ? this->treeDirection : this->direction;
|
|
|
|
}
|
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
void Settings_delete(Settings* this);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
bool Settings_write(Settings* this);
|
2006-03-04 18:16:49 +00:00
|
|
|
|
2020-09-23 11:52:57 +02:00
|
|
|
Settings* Settings_new(int initialCpuCount);
|
2015-01-21 23:27:31 -02:00
|
|
|
|
2020-09-02 02:38:44 -05:00
|
|
|
void Settings_invertSortOrder(Settings* this);
|
2008-03-09 08:58:38 +00:00
|
|
|
|
2020-12-18 11:03:31 -03:00
|
|
|
void Settings_setSortKey(Settings* this, ProcessField sortKey);
|
|
|
|
|
2006-03-04 18:16:49 +00:00
|
|
|
#endif
|