mirror of https://github.com/xzeldon/htop.git
Spacing around operators
This commit is contained in:
parent
b23f8235e2
commit
61e14d4bb2
12
Action.c
12
Action.c
|
@ -59,7 +59,7 @@ Object* Action_pickFromVector(State* st, Panel* list, int x, bool followProcess)
|
||||||
}
|
}
|
||||||
ScreenManager_delete(scr);
|
ScreenManager_delete(scr);
|
||||||
Panel_move(panel, 0, y);
|
Panel_move(panel, 0, y);
|
||||||
Panel_resize(panel, COLS, LINES-y-1);
|
Panel_resize(panel, COLS, LINES - y - 1);
|
||||||
if (panelFocus == list && ch == 13) {
|
if (panelFocus == list && ch == 13) {
|
||||||
if (followProcess) {
|
if (followProcess) {
|
||||||
Process* selected = (Process*)Panel_getSelected(panel);
|
Process* selected = (Process*)Panel_getSelected(panel);
|
||||||
|
@ -181,7 +181,7 @@ static Htop_Reaction sortBy(State* st) {
|
||||||
|
|
||||||
static Htop_Reaction actionResize(State* st) {
|
static Htop_Reaction actionResize(State* st) {
|
||||||
clear();
|
clear();
|
||||||
Panel_resize(st->panel, COLS, LINES-(st->panel->y)-1);
|
Panel_resize(st->panel, COLS, LINES - (st->panel->y) - 1);
|
||||||
return HTOP_REDRAW_BAR;
|
return HTOP_REDRAW_BAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -393,12 +393,12 @@ static Htop_Reaction actionTag(State* st) {
|
||||||
return HTOP_OK;
|
return HTOP_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Htop_Reaction actionRedraw(ATTR_UNUSED State *st) {
|
static Htop_Reaction actionRedraw(ATTR_UNUSED State* st) {
|
||||||
clear();
|
clear();
|
||||||
return HTOP_REFRESH | HTOP_REDRAW_BAR;
|
return HTOP_REFRESH | HTOP_REDRAW_BAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Htop_Reaction actionTogglePauseProcessUpdate(State *st) {
|
static Htop_Reaction actionTogglePauseProcessUpdate(State* st) {
|
||||||
st->pauseProcessUpdate = !st->pauseProcessUpdate;
|
st->pauseProcessUpdate = !st->pauseProcessUpdate;
|
||||||
return HTOP_REFRESH | HTOP_REDRAW_BAR;
|
return HTOP_REFRESH | HTOP_REDRAW_BAR;
|
||||||
}
|
}
|
||||||
|
@ -454,7 +454,7 @@ static Htop_Reaction actionHelp(State* st) {
|
||||||
clear();
|
clear();
|
||||||
attrset(CRT_colors[HELP_BOLD]);
|
attrset(CRT_colors[HELP_BOLD]);
|
||||||
|
|
||||||
for (int i = 0; i < LINES-1; i++)
|
for (int i = 0; i < LINES - 1; i++)
|
||||||
mvhline(i, 0, ' ', COLS);
|
mvhline(i, 0, ' ', COLS);
|
||||||
|
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
@ -500,7 +500,7 @@ static Htop_Reaction actionHelp(State* st) {
|
||||||
addattrstr(CRT_colors[BAR_SHADOW], " used/total");
|
addattrstr(CRT_colors[BAR_SHADOW], " used/total");
|
||||||
addattrstr(CRT_colors[BAR_BORDER], "]");
|
addattrstr(CRT_colors[BAR_BORDER], "]");
|
||||||
attrset(CRT_colors[DEFAULT_COLOR]);
|
attrset(CRT_colors[DEFAULT_COLOR]);
|
||||||
mvaddstr(line++,0, "Type and layout of header meters are configurable in the setup screen.");
|
mvaddstr(line++, 0, "Type and layout of header meters are configurable in the setup screen.");
|
||||||
if (CRT_colorScheme == COLORSCHEME_MONOCHROME) {
|
if (CRT_colorScheme == COLORSCHEME_MONOCHROME) {
|
||||||
mvaddstr(line, 0, "In monochrome, meters display as different chars, in order: |#*@$%&.");
|
mvaddstr(line, 0, "In monochrome, meters display as different chars, in order: |#*@$%&.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ Affinity* Affinity_get(Process* proc, ProcessList* pl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Affinity_set(Process* proc, Arg arg) {
|
bool Affinity_set(Process* proc, Arg arg) {
|
||||||
Affinity *this = arg.v;
|
Affinity* this = arg.v;
|
||||||
hwloc_cpuset_t cpuset = hwloc_bitmap_alloc();
|
hwloc_cpuset_t cpuset = hwloc_bitmap_alloc();
|
||||||
for (int i = 0; i < this->used; i++) {
|
for (int i = 0; i < this->used; i++) {
|
||||||
hwloc_bitmap_set(cpuset, this->cpus[i]);
|
hwloc_bitmap_set(cpuset, this->cpus[i]);
|
||||||
|
@ -99,7 +99,7 @@ Affinity* Affinity_get(Process* proc, ProcessList* pl) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Affinity_set(Process* proc, Arg arg) {
|
bool Affinity_set(Process* proc, Arg arg) {
|
||||||
Affinity *this = arg.v;
|
Affinity* this = arg.v;
|
||||||
cpu_set_t cpuset;
|
cpu_set_t cpuset;
|
||||||
CPU_ZERO(&cpuset);
|
CPU_ZERO(&cpuset);
|
||||||
for (int i = 0; i < this->used; i++) {
|
for (int i = 0; i < this->used; i++) {
|
||||||
|
|
|
@ -35,7 +35,7 @@ typedef struct MaskItem_ {
|
||||||
char* indent; /* used also as an condition whether this is a tree node */
|
char* indent; /* used also as an condition whether this is a tree node */
|
||||||
int value; /* tri-state: 0 - off, 1 - some set, 2 - all set */
|
int value; /* tri-state: 0 - off, 1 - some set, 2 - all set */
|
||||||
int sub_tree; /* tri-state: 0 - no sub-tree, 1 - open sub-tree, 2 - closed sub-tree */
|
int sub_tree; /* tri-state: 0 - no sub-tree, 1 - open sub-tree, 2 - closed sub-tree */
|
||||||
Vector *children;
|
Vector* children;
|
||||||
#ifdef HAVE_LIBHWLOC
|
#ifdef HAVE_LIBHWLOC
|
||||||
bool ownCpuset;
|
bool ownCpuset;
|
||||||
hwloc_bitmap_t cpuset;
|
hwloc_bitmap_t cpuset;
|
||||||
|
@ -123,11 +123,11 @@ typedef struct AffinityPanel_ {
|
||||||
Panel super;
|
Panel super;
|
||||||
ProcessList* pl;
|
ProcessList* pl;
|
||||||
bool topoView;
|
bool topoView;
|
||||||
Vector *cpuids;
|
Vector* cpuids;
|
||||||
unsigned width;
|
unsigned width;
|
||||||
|
|
||||||
#ifdef HAVE_LIBHWLOC
|
#ifdef HAVE_LIBHWLOC
|
||||||
MaskItem *topoRoot;
|
MaskItem* topoRoot;
|
||||||
hwloc_const_cpuset_t allCpuset;
|
hwloc_const_cpuset_t allCpuset;
|
||||||
hwloc_bitmap_t workCpuset;
|
hwloc_bitmap_t workCpuset;
|
||||||
#endif
|
#endif
|
||||||
|
@ -262,7 +262,7 @@ static HandlerResult AffinityPanel_eventHandler(Panel* super, int ch) {
|
||||||
|
|
||||||
#ifdef HAVE_LIBHWLOC
|
#ifdef HAVE_LIBHWLOC
|
||||||
|
|
||||||
static MaskItem *AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem *parent) {
|
static MaskItem* AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem* parent) {
|
||||||
const char* type_name = hwloc_obj_type_string(obj->type);
|
const char* type_name = hwloc_obj_type_string(obj->type);
|
||||||
const char* index_prefix = "#";
|
const char* index_prefix = "#";
|
||||||
unsigned depth = obj->depth;
|
unsigned depth = obj->depth;
|
||||||
|
@ -294,7 +294,7 @@ static MaskItem *AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u
|
||||||
|
|
||||||
xSnprintf(buf, 64, "%s %s%u", type_name, index_prefix, index);
|
xSnprintf(buf, 64, "%s %s%u", type_name, index_prefix, index);
|
||||||
|
|
||||||
MaskItem *item = MaskItem_newMask(buf, indent_buf, obj->complete_cpuset, false);
|
MaskItem* item = MaskItem_newMask(buf, indent_buf, obj->complete_cpuset, false);
|
||||||
if (parent)
|
if (parent)
|
||||||
Vector_add(parent->children, item);
|
Vector_add(parent->children, item);
|
||||||
|
|
||||||
|
@ -316,8 +316,8 @@ static MaskItem *AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static MaskItem *AffinityPanel_buildTopology(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem *parent) {
|
static MaskItem* AffinityPanel_buildTopology(AffinityPanel* this, hwloc_obj_t obj, unsigned indent, MaskItem* parent) {
|
||||||
MaskItem *item = AffinityPanel_addObject(this, obj, indent, parent);
|
MaskItem* item = AffinityPanel_addObject(this, obj, indent, parent);
|
||||||
if (obj->next_sibling) {
|
if (obj->next_sibling) {
|
||||||
indent |= (1u << obj->depth);
|
indent |= (1u << obj->depth);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -21,7 +21,7 @@ static const int BatteryMeter_attributes[] = {
|
||||||
BATTERY
|
BATTERY
|
||||||
};
|
};
|
||||||
|
|
||||||
static void BatteryMeter_updateValues(Meter * this, char *buffer, int len) {
|
static void BatteryMeter_updateValues(Meter* this, char* buffer, int len) {
|
||||||
ACPresence isOnAC;
|
ACPresence isOnAC;
|
||||||
double percent;
|
double percent;
|
||||||
|
|
||||||
|
|
14
CPUMeter.c
14
CPUMeter.c
|
@ -149,7 +149,7 @@ static void AllCPUsMeter_getRange(Meter* this, int* start, int* count) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CPUMeterCommonInit(Meter *this, int ncol) {
|
static void CPUMeterCommonInit(Meter* this, int ncol) {
|
||||||
int cpus = this->pl->cpuCount;
|
int cpus = this->pl->cpuCount;
|
||||||
CPUMeterData* data = this->meterData;
|
CPUMeterData* data = this->meterData;
|
||||||
if (!data) {
|
if (!data) {
|
||||||
|
@ -162,13 +162,13 @@ static void CPUMeterCommonInit(Meter *this, int ncol) {
|
||||||
AllCPUsMeter_getRange(this, &start, &count);
|
AllCPUsMeter_getRange(this, &start, &count);
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
if (!meters[i])
|
if (!meters[i])
|
||||||
meters[i] = Meter_new(this->pl, start+i+1, (const MeterClass*) Class(CPUMeter));
|
meters[i] = Meter_new(this->pl, start + i + 1, (const MeterClass*) Class(CPUMeter));
|
||||||
Meter_init(meters[i]);
|
Meter_init(meters[i]);
|
||||||
}
|
}
|
||||||
if (this->mode == 0)
|
if (this->mode == 0)
|
||||||
this->mode = BAR_METERMODE;
|
this->mode = BAR_METERMODE;
|
||||||
int h = Meter_modes[this->mode]->h;
|
int h = Meter_modes[this->mode]->h;
|
||||||
this->h = h * ((count + ncol - 1)/ ncol);
|
this->h = h * ((count + ncol - 1) / ncol);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CPUMeterCommonUpdateMode(Meter* this, int mode, int ncol) {
|
static void CPUMeterCommonUpdateMode(Meter* this, int mode, int ncol) {
|
||||||
|
@ -181,7 +181,7 @@ static void CPUMeterCommonUpdateMode(Meter* this, int mode, int ncol) {
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 0; i < count; i++) {
|
||||||
Meter_setMode(meters[i], mode);
|
Meter_setMode(meters[i], mode);
|
||||||
}
|
}
|
||||||
this->h = h * ((count + ncol - 1)/ ncol);
|
this->h = h * ((count + ncol - 1) / ncol);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AllCPUsMeter_done(Meter* this) {
|
static void AllCPUsMeter_done(Meter* this) {
|
||||||
|
@ -232,11 +232,11 @@ static void CPUMeterCommonDraw(Meter* this, int x, int y, int w, int ncol) {
|
||||||
Meter** meters = data->meters;
|
Meter** meters = data->meters;
|
||||||
int start, count;
|
int start, count;
|
||||||
AllCPUsMeter_getRange(this, &start, &count);
|
AllCPUsMeter_getRange(this, &start, &count);
|
||||||
int colwidth = (w-ncol)/ncol + 1;
|
int colwidth = (w - ncol) / ncol + 1;
|
||||||
int diff = (w - (colwidth * ncol));
|
int diff = (w - (colwidth * ncol));
|
||||||
int nrows = (count + ncol - 1) / ncol;
|
int nrows = (count + ncol - 1) / ncol;
|
||||||
for (int i = 0; i < count; i++){
|
for (int i = 0; i < count; i++) {
|
||||||
int d = (i/nrows) > diff ? diff : (i / nrows) ; // dynamic spacer
|
int d = (i / nrows) > diff ? diff : (i / nrows); // dynamic spacer
|
||||||
int xpos = x + ((i / nrows) * colwidth) + d;
|
int xpos = x + ((i / nrows) * colwidth) + d;
|
||||||
int ypos = y + ((i % nrows) * meters[0]->h);
|
int ypos = y + ((i % nrows) * meters[0]->h);
|
||||||
meters[i]->draw(meters[i], xpos, ypos, colwidth);
|
meters[i]->draw(meters[i], xpos, ypos, colwidth);
|
||||||
|
|
738
CRT.c
738
CRT.c
|
@ -42,7 +42,7 @@ in the source distribution for its full text.
|
||||||
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
|
#define ColorPairGrayBlack ColorPair(Magenta,Magenta)
|
||||||
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)
|
#define ColorIndexGrayBlack ColorIndex(Magenta,Magenta)
|
||||||
|
|
||||||
static const char *const CRT_treeStrAscii[TREE_STR_COUNT] = {
|
static const char* const CRT_treeStrAscii[TREE_STR_COUNT] = {
|
||||||
"-", // TREE_STR_HORZ
|
"-", // TREE_STR_HORZ
|
||||||
"|", // TREE_STR_VERT
|
"|", // TREE_STR_VERT
|
||||||
"`", // TREE_STR_RTEE
|
"`", // TREE_STR_RTEE
|
||||||
|
@ -54,7 +54,7 @@ static const char *const CRT_treeStrAscii[TREE_STR_COUNT] = {
|
||||||
|
|
||||||
#ifdef HAVE_LIBNCURSESW
|
#ifdef HAVE_LIBNCURSESW
|
||||||
|
|
||||||
static const char *const CRT_treeStrUtf8[TREE_STR_COUNT] = {
|
static const char* const CRT_treeStrUtf8[TREE_STR_COUNT] = {
|
||||||
"\xe2\x94\x80", // TREE_STR_HORZ ─
|
"\xe2\x94\x80", // TREE_STR_HORZ ─
|
||||||
"\xe2\x94\x82", // TREE_STR_VERT │
|
"\xe2\x94\x82", // TREE_STR_VERT │
|
||||||
"\xe2\x94\x9c", // TREE_STR_RTEE ├
|
"\xe2\x94\x9c", // TREE_STR_RTEE ├
|
||||||
|
@ -70,7 +70,7 @@ bool CRT_utf8 = false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const char *const *CRT_treeStr = CRT_treeStrAscii;
|
const char* const* CRT_treeStr = CRT_treeStrAscii;
|
||||||
|
|
||||||
int CRT_delay;
|
int CRT_delay;
|
||||||
|
|
||||||
|
@ -78,82 +78,82 @@ const int* CRT_colors;
|
||||||
|
|
||||||
int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||||
[COLORSCHEME_DEFAULT] = {
|
[COLORSCHEME_DEFAULT] = {
|
||||||
[RESET_COLOR] = ColorPair(White,Black),
|
[RESET_COLOR] = ColorPair(White, Black),
|
||||||
[DEFAULT_COLOR] = ColorPair(White,Black),
|
[DEFAULT_COLOR] = ColorPair(White, Black),
|
||||||
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
||||||
[FUNCTION_KEY] = ColorPair(White,Black),
|
[FUNCTION_KEY] = ColorPair(White, Black),
|
||||||
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
||||||
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
||||||
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black,White),
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black, White),
|
||||||
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
||||||
[PAUSED] = A_BOLD | ColorPair(Yellow,Cyan),
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
||||||
[UPTIME] = A_BOLD | ColorPair(Cyan,Black),
|
[UPTIME] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[BATTERY] = A_BOLD | ColorPair(Cyan,Black),
|
[BATTERY] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red, Black),
|
||||||
[METER_TEXT] = ColorPair(Cyan,Black),
|
[METER_TEXT] = ColorPair(Cyan, Black),
|
||||||
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Black),
|
[METER_VALUE] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Black),
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black),
|
||||||
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White,Black),
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White, Black),
|
||||||
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
|
[METER_VALUE_IOREAD] = ColorPair(Green, Black),
|
||||||
[METER_VALUE_IOWRITE] = ColorPair(Blue,Black),
|
[METER_VALUE_IOWRITE] = ColorPair(Blue, Black),
|
||||||
[LED_COLOR] = ColorPair(Green,Black),
|
[LED_COLOR] = ColorPair(Green, Black),
|
||||||
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green, Black),
|
||||||
[PROCESS] = A_NORMAL,
|
[PROCESS] = A_NORMAL,
|
||||||
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
||||||
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black),
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow, Black),
|
||||||
[PROCESS_MEGABYTES] = ColorPair(Cyan,Black),
|
[PROCESS_MEGABYTES] = ColorPair(Cyan, Black),
|
||||||
[PROCESS_GIGABYTES] = ColorPair(Green,Black),
|
[PROCESS_GIGABYTES] = ColorPair(Green, Black),
|
||||||
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Black),
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[PROCESS_TREE] = ColorPair(Cyan,Black),
|
[PROCESS_TREE] = ColorPair(Cyan, Black),
|
||||||
[PROCESS_R_STATE] = ColorPair(Green,Black),
|
[PROCESS_R_STATE] = ColorPair(Green, Black),
|
||||||
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black),
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Black),
|
||||||
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black),
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Black),
|
||||||
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Black),
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Black),
|
||||||
[PROCESS_THREAD] = ColorPair(Green,Black),
|
[PROCESS_THREAD] = ColorPair(Green, Black),
|
||||||
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green,Black),
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green, Black),
|
||||||
[BAR_BORDER] = A_BOLD,
|
[BAR_BORDER] = A_BOLD,
|
||||||
[BAR_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
[BAR_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
||||||
[SWAP] = ColorPair(Red,Black),
|
[SWAP] = ColorPair(Red, Black),
|
||||||
[GRAPH_1] = A_BOLD | ColorPair(Cyan,Black),
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[GRAPH_2] = ColorPair(Cyan,Black),
|
[GRAPH_2] = ColorPair(Cyan, Black),
|
||||||
[MEMORY_USED] = ColorPair(Green,Black),
|
[MEMORY_USED] = ColorPair(Green, Black),
|
||||||
[MEMORY_BUFFERS] = ColorPair(Blue,Black),
|
[MEMORY_BUFFERS] = ColorPair(Blue, Black),
|
||||||
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[MEMORY_CACHE] = ColorPair(Yellow,Black),
|
[MEMORY_CACHE] = ColorPair(Yellow, Black),
|
||||||
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Cyan,Black),
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Cyan, Black),
|
||||||
[LOAD_AVERAGE_FIVE] = A_BOLD | ColorPair(Cyan,Black),
|
[LOAD_AVERAGE_FIVE] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White,Black),
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White, Black),
|
||||||
[LOAD] = A_BOLD,
|
[LOAD] = A_BOLD,
|
||||||
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black),
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[CLOCK] = A_BOLD,
|
[CLOCK] = A_BOLD,
|
||||||
[DATE] = A_BOLD,
|
[DATE] = A_BOLD,
|
||||||
[DATETIME] = A_BOLD,
|
[DATETIME] = A_BOLD,
|
||||||
[CHECK_BOX] = ColorPair(Cyan,Black),
|
[CHECK_BOX] = ColorPair(Cyan, Black),
|
||||||
[CHECK_MARK] = A_BOLD,
|
[CHECK_MARK] = A_BOLD,
|
||||||
[CHECK_TEXT] = A_NORMAL,
|
[CHECK_TEXT] = A_NORMAL,
|
||||||
[HOSTNAME] = A_BOLD,
|
[HOSTNAME] = A_BOLD,
|
||||||
[CPU_NICE] = ColorPair(Blue,Black),
|
[CPU_NICE] = ColorPair(Blue, Black),
|
||||||
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[CPU_NORMAL] = ColorPair(Green,Black),
|
[CPU_NORMAL] = ColorPair(Green, Black),
|
||||||
[CPU_SYSTEM] = ColorPair(Red,Black),
|
[CPU_SYSTEM] = ColorPair(Red, Black),
|
||||||
[CPU_IOWAIT] = A_BOLD | ColorPairGrayBlack,
|
[CPU_IOWAIT] = A_BOLD | ColorPairGrayBlack,
|
||||||
[CPU_IRQ] = ColorPair(Yellow,Black),
|
[CPU_IRQ] = ColorPair(Yellow, Black),
|
||||||
[CPU_SOFTIRQ] = ColorPair(Magenta,Black),
|
[CPU_SOFTIRQ] = ColorPair(Magenta, Black),
|
||||||
[CPU_STEAL] = ColorPair(Cyan,Black),
|
[CPU_STEAL] = ColorPair(Cyan, Black),
|
||||||
[CPU_GUEST] = ColorPair(Cyan,Black),
|
[CPU_GUEST] = ColorPair(Cyan, Black),
|
||||||
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Cyan,Black),
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Cyan, Black),
|
||||||
[PRESSURE_STALL_SIXTY] = A_BOLD | ColorPair(Cyan,Black),
|
[PRESSURE_STALL_SIXTY] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White,Black),
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White, Black),
|
||||||
[ZFS_MFU] = ColorPair(Blue,Black),
|
[ZFS_MFU] = ColorPair(Blue, Black),
|
||||||
[ZFS_MRU] = ColorPair(Yellow,Black),
|
[ZFS_MRU] = ColorPair(Yellow, Black),
|
||||||
[ZFS_ANON] = ColorPair(Magenta,Black),
|
[ZFS_ANON] = ColorPair(Magenta, Black),
|
||||||
[ZFS_HEADER] = ColorPair(Cyan,Black),
|
[ZFS_HEADER] = ColorPair(Cyan, Black),
|
||||||
[ZFS_OTHER] = ColorPair(Magenta,Black),
|
[ZFS_OTHER] = ColorPair(Magenta, Black),
|
||||||
[ZFS_COMPRESSED] = ColorPair(Blue,Black),
|
[ZFS_COMPRESSED] = ColorPair(Blue, Black),
|
||||||
[ZFS_RATIO] = ColorPair(Magenta,Black),
|
[ZFS_RATIO] = ColorPair(Magenta, Black),
|
||||||
[ZRAM] = ColorPair(Yellow,Black),
|
[ZRAM] = ColorPair(Yellow, Black),
|
||||||
},
|
},
|
||||||
[COLORSCHEME_MONOCHROME] = {
|
[COLORSCHEME_MONOCHROME] = {
|
||||||
[RESET_COLOR] = A_NORMAL,
|
[RESET_COLOR] = A_NORMAL,
|
||||||
|
@ -234,314 +234,314 @@ int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT] = {
|
||||||
[ZRAM] = A_NORMAL,
|
[ZRAM] = A_NORMAL,
|
||||||
},
|
},
|
||||||
[COLORSCHEME_BLACKONWHITE] = {
|
[COLORSCHEME_BLACKONWHITE] = {
|
||||||
[RESET_COLOR] = ColorPair(Black,White),
|
[RESET_COLOR] = ColorPair(Black, White),
|
||||||
[DEFAULT_COLOR] = ColorPair(Black,White),
|
[DEFAULT_COLOR] = ColorPair(Black, White),
|
||||||
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
||||||
[FUNCTION_KEY] = ColorPair(Black,White),
|
[FUNCTION_KEY] = ColorPair(Black, White),
|
||||||
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
||||||
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
||||||
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue,White),
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue, White),
|
||||||
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
||||||
[PAUSED] = A_BOLD | ColorPair(Yellow,Cyan),
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
||||||
[UPTIME] = ColorPair(Yellow,White),
|
[UPTIME] = ColorPair(Yellow, White),
|
||||||
[BATTERY] = ColorPair(Yellow,White),
|
[BATTERY] = ColorPair(Yellow, White),
|
||||||
[LARGE_NUMBER] = ColorPair(Red,White),
|
[LARGE_NUMBER] = ColorPair(Red, White),
|
||||||
[METER_TEXT] = ColorPair(Blue,White),
|
[METER_TEXT] = ColorPair(Blue, White),
|
||||||
[METER_VALUE] = ColorPair(Black,White),
|
[METER_VALUE] = ColorPair(Black, White),
|
||||||
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,White),
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, White),
|
||||||
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,White),
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow, White),
|
||||||
[METER_VALUE_IOREAD] = ColorPair(Green,White),
|
[METER_VALUE_IOREAD] = ColorPair(Green, White),
|
||||||
[METER_VALUE_IOWRITE] = ColorPair(Yellow,White),
|
[METER_VALUE_IOWRITE] = ColorPair(Yellow, White),
|
||||||
[LED_COLOR] = ColorPair(Green,White),
|
[LED_COLOR] = ColorPair(Green, White),
|
||||||
[TASKS_RUNNING] = ColorPair(Green,White),
|
[TASKS_RUNNING] = ColorPair(Green, White),
|
||||||
[PROCESS] = ColorPair(Black,White),
|
[PROCESS] = ColorPair(Black, White),
|
||||||
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,White),
|
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black, White),
|
||||||
[PROCESS_TAG] = ColorPair(White,Blue),
|
[PROCESS_TAG] = ColorPair(White, Blue),
|
||||||
[PROCESS_MEGABYTES] = ColorPair(Blue,White),
|
[PROCESS_MEGABYTES] = ColorPair(Blue, White),
|
||||||
[PROCESS_GIGABYTES] = ColorPair(Green,White),
|
[PROCESS_GIGABYTES] = ColorPair(Green, White),
|
||||||
[PROCESS_BASENAME] = ColorPair(Blue,White),
|
[PROCESS_BASENAME] = ColorPair(Blue, White),
|
||||||
[PROCESS_TREE] = ColorPair(Green,White),
|
[PROCESS_TREE] = ColorPair(Green, White),
|
||||||
[PROCESS_R_STATE] = ColorPair(Green,White),
|
[PROCESS_R_STATE] = ColorPair(Green, White),
|
||||||
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,White),
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, White),
|
||||||
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,White),
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, White),
|
||||||
[PROCESS_LOW_PRIORITY] = ColorPair(Green,White),
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, White),
|
||||||
[PROCESS_THREAD] = ColorPair(Blue,White),
|
[PROCESS_THREAD] = ColorPair(Blue, White),
|
||||||
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,White),
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue, White),
|
||||||
[BAR_BORDER] = ColorPair(Blue,White),
|
[BAR_BORDER] = ColorPair(Blue, White),
|
||||||
[BAR_SHADOW] = ColorPair(Black,White),
|
[BAR_SHADOW] = ColorPair(Black, White),
|
||||||
[SWAP] = ColorPair(Red,White),
|
[SWAP] = ColorPair(Red, White),
|
||||||
[GRAPH_1] = A_BOLD | ColorPair(Blue,White),
|
[GRAPH_1] = A_BOLD | ColorPair(Blue, White),
|
||||||
[GRAPH_2] = ColorPair(Blue,White),
|
[GRAPH_2] = ColorPair(Blue, White),
|
||||||
[MEMORY_USED] = ColorPair(Green,White),
|
[MEMORY_USED] = ColorPair(Green, White),
|
||||||
[MEMORY_BUFFERS] = ColorPair(Cyan,White),
|
[MEMORY_BUFFERS] = ColorPair(Cyan, White),
|
||||||
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,White),
|
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan, White),
|
||||||
[MEMORY_CACHE] = ColorPair(Yellow,White),
|
[MEMORY_CACHE] = ColorPair(Yellow, White),
|
||||||
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black,White),
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Black, White),
|
||||||
[LOAD_AVERAGE_FIVE] = ColorPair(Black,White),
|
[LOAD_AVERAGE_FIVE] = ColorPair(Black, White),
|
||||||
[LOAD_AVERAGE_ONE] = ColorPair(Black,White),
|
[LOAD_AVERAGE_ONE] = ColorPair(Black, White),
|
||||||
[LOAD] = ColorPair(Black,White),
|
[LOAD] = ColorPair(Black, White),
|
||||||
[HELP_BOLD] = ColorPair(Blue,White),
|
[HELP_BOLD] = ColorPair(Blue, White),
|
||||||
[CLOCK] = ColorPair(Black,White),
|
[CLOCK] = ColorPair(Black, White),
|
||||||
[DATE] = ColorPair(Black,White),
|
[DATE] = ColorPair(Black, White),
|
||||||
[DATETIME] = ColorPair(Black,White),
|
[DATETIME] = ColorPair(Black, White),
|
||||||
[CHECK_BOX] = ColorPair(Blue,White),
|
[CHECK_BOX] = ColorPair(Blue, White),
|
||||||
[CHECK_MARK] = ColorPair(Black,White),
|
[CHECK_MARK] = ColorPair(Black, White),
|
||||||
[CHECK_TEXT] = ColorPair(Black,White),
|
[CHECK_TEXT] = ColorPair(Black, White),
|
||||||
[HOSTNAME] = ColorPair(Black,White),
|
[HOSTNAME] = ColorPair(Black, White),
|
||||||
[CPU_NICE] = ColorPair(Cyan,White),
|
[CPU_NICE] = ColorPair(Cyan, White),
|
||||||
[CPU_NICE_TEXT] = ColorPair(Cyan,White),
|
[CPU_NICE_TEXT] = ColorPair(Cyan, White),
|
||||||
[CPU_NORMAL] = ColorPair(Green,White),
|
[CPU_NORMAL] = ColorPair(Green, White),
|
||||||
[CPU_SYSTEM] = ColorPair(Red,White),
|
[CPU_SYSTEM] = ColorPair(Red, White),
|
||||||
[CPU_IOWAIT] = A_BOLD | ColorPair(Black,White),
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Black, White),
|
||||||
[CPU_IRQ] = ColorPair(Blue,White),
|
[CPU_IRQ] = ColorPair(Blue, White),
|
||||||
[CPU_SOFTIRQ] = ColorPair(Blue,White),
|
[CPU_SOFTIRQ] = ColorPair(Blue, White),
|
||||||
[CPU_STEAL] = ColorPair(Cyan,White),
|
[CPU_STEAL] = ColorPair(Cyan, White),
|
||||||
[CPU_GUEST] = ColorPair(Cyan,White),
|
[CPU_GUEST] = ColorPair(Cyan, White),
|
||||||
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Black,White),
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Black, White),
|
||||||
[PRESSURE_STALL_SIXTY] = ColorPair(Black,White),
|
[PRESSURE_STALL_SIXTY] = ColorPair(Black, White),
|
||||||
[PRESSURE_STALL_TEN] = ColorPair(Black,White),
|
[PRESSURE_STALL_TEN] = ColorPair(Black, White),
|
||||||
[ZFS_MFU] = ColorPair(Cyan,White),
|
[ZFS_MFU] = ColorPair(Cyan, White),
|
||||||
[ZFS_MRU] = ColorPair(Yellow,White),
|
[ZFS_MRU] = ColorPair(Yellow, White),
|
||||||
[ZFS_ANON] = ColorPair(Magenta,White),
|
[ZFS_ANON] = ColorPair(Magenta, White),
|
||||||
[ZFS_HEADER] = ColorPair(Yellow,White),
|
[ZFS_HEADER] = ColorPair(Yellow, White),
|
||||||
[ZFS_OTHER] = ColorPair(Magenta,White),
|
[ZFS_OTHER] = ColorPair(Magenta, White),
|
||||||
[ZFS_COMPRESSED] = ColorPair(Cyan,White),
|
[ZFS_COMPRESSED] = ColorPair(Cyan, White),
|
||||||
[ZFS_RATIO] = ColorPair(Magenta,White),
|
[ZFS_RATIO] = ColorPair(Magenta, White),
|
||||||
[ZRAM] = ColorPair(Yellow,White)
|
[ZRAM] = ColorPair(Yellow, White)
|
||||||
},
|
},
|
||||||
[COLORSCHEME_LIGHTTERMINAL] = {
|
[COLORSCHEME_LIGHTTERMINAL] = {
|
||||||
[RESET_COLOR] = ColorPair(Blue,Black),
|
[RESET_COLOR] = ColorPair(Blue, Black),
|
||||||
[DEFAULT_COLOR] = ColorPair(Blue,Black),
|
[DEFAULT_COLOR] = ColorPair(Blue, Black),
|
||||||
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
||||||
[FUNCTION_KEY] = ColorPair(Blue,Black),
|
[FUNCTION_KEY] = ColorPair(Blue, Black),
|
||||||
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
||||||
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
||||||
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue,Black),
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Blue, Black),
|
||||||
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
||||||
[PAUSED] = A_BOLD | ColorPair(Yellow,Cyan),
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
||||||
[UPTIME] = ColorPair(Yellow,Black),
|
[UPTIME] = ColorPair(Yellow, Black),
|
||||||
[BATTERY] = ColorPair(Yellow,Black),
|
[BATTERY] = ColorPair(Yellow, Black),
|
||||||
[LARGE_NUMBER] = ColorPair(Red,Black),
|
[LARGE_NUMBER] = ColorPair(Red, Black),
|
||||||
[METER_TEXT] = ColorPair(Blue,Black),
|
[METER_TEXT] = ColorPair(Blue, Black),
|
||||||
[METER_VALUE] = ColorPair(Blue,Black),
|
[METER_VALUE] = ColorPair(Blue, Black),
|
||||||
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Black),
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black),
|
||||||
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,Black),
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow, Black),
|
||||||
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
|
[METER_VALUE_IOREAD] = ColorPair(Green, Black),
|
||||||
[METER_VALUE_IOWRITE] = ColorPair(Yellow,Black),
|
[METER_VALUE_IOWRITE] = ColorPair(Yellow, Black),
|
||||||
[LED_COLOR] = ColorPair(Green,Black),
|
[LED_COLOR] = ColorPair(Green, Black),
|
||||||
[TASKS_RUNNING] = ColorPair(Green,Black),
|
[TASKS_RUNNING] = ColorPair(Green, Black),
|
||||||
[PROCESS] = ColorPair(Blue,Black),
|
[PROCESS] = ColorPair(Blue, Black),
|
||||||
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
||||||
[PROCESS_TAG] = ColorPair(Yellow,Blue),
|
[PROCESS_TAG] = ColorPair(Yellow, Blue),
|
||||||
[PROCESS_MEGABYTES] = ColorPair(Blue,Black),
|
[PROCESS_MEGABYTES] = ColorPair(Blue, Black),
|
||||||
[PROCESS_GIGABYTES] = ColorPair(Green,Black),
|
[PROCESS_GIGABYTES] = ColorPair(Green, Black),
|
||||||
[PROCESS_BASENAME] = ColorPair(Green,Black),
|
[PROCESS_BASENAME] = ColorPair(Green, Black),
|
||||||
[PROCESS_TREE] = ColorPair(Blue,Black),
|
[PROCESS_TREE] = ColorPair(Blue, Black),
|
||||||
[PROCESS_R_STATE] = ColorPair(Green,Black),
|
[PROCESS_R_STATE] = ColorPair(Green, Black),
|
||||||
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black),
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Black),
|
||||||
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black),
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Black),
|
||||||
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Black),
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Black),
|
||||||
[PROCESS_THREAD] = ColorPair(Blue,Black),
|
[PROCESS_THREAD] = ColorPair(Blue, Black),
|
||||||
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,Black),
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[BAR_BORDER] = ColorPair(Blue,Black),
|
[BAR_BORDER] = ColorPair(Blue, Black),
|
||||||
[BAR_SHADOW] = ColorPairGrayBlack,
|
[BAR_SHADOW] = ColorPairGrayBlack,
|
||||||
[SWAP] = ColorPair(Red,Black),
|
[SWAP] = ColorPair(Red, Black),
|
||||||
[GRAPH_1] = A_BOLD | ColorPair(Cyan,Black),
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[GRAPH_2] = ColorPair(Cyan,Black),
|
[GRAPH_2] = ColorPair(Cyan, Black),
|
||||||
[MEMORY_USED] = ColorPair(Green,Black),
|
[MEMORY_USED] = ColorPair(Green, Black),
|
||||||
[MEMORY_BUFFERS] = ColorPair(Cyan,Black),
|
[MEMORY_BUFFERS] = ColorPair(Cyan, Black),
|
||||||
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan,Black),
|
[MEMORY_BUFFERS_TEXT] = ColorPair(Cyan, Black),
|
||||||
[MEMORY_CACHE] = ColorPair(Yellow,Black),
|
[MEMORY_CACHE] = ColorPair(Yellow, Black),
|
||||||
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Blue,Black),
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Blue, Black),
|
||||||
[LOAD_AVERAGE_FIVE] = ColorPair(Blue,Black),
|
[LOAD_AVERAGE_FIVE] = ColorPair(Blue, Black),
|
||||||
[LOAD_AVERAGE_ONE] = ColorPair(Yellow,Black),
|
[LOAD_AVERAGE_ONE] = ColorPair(Yellow, Black),
|
||||||
[LOAD] = ColorPair(Yellow,Black),
|
[LOAD] = ColorPair(Yellow, Black),
|
||||||
[HELP_BOLD] = ColorPair(Blue,Black),
|
[HELP_BOLD] = ColorPair(Blue, Black),
|
||||||
[CLOCK] = ColorPair(Yellow,Black),
|
[CLOCK] = ColorPair(Yellow, Black),
|
||||||
[DATE] = ColorPair(White,Black),
|
[DATE] = ColorPair(White, Black),
|
||||||
[DATETIME] = ColorPair(White,Black),
|
[DATETIME] = ColorPair(White, Black),
|
||||||
[CHECK_BOX] = ColorPair(Blue,Black),
|
[CHECK_BOX] = ColorPair(Blue, Black),
|
||||||
[CHECK_MARK] = ColorPair(Blue,Black),
|
[CHECK_MARK] = ColorPair(Blue, Black),
|
||||||
[CHECK_TEXT] = ColorPair(Blue,Black),
|
[CHECK_TEXT] = ColorPair(Blue, Black),
|
||||||
[HOSTNAME] = ColorPair(Yellow,Black),
|
[HOSTNAME] = ColorPair(Yellow, Black),
|
||||||
[CPU_NICE] = ColorPair(Cyan,Black),
|
[CPU_NICE] = ColorPair(Cyan, Black),
|
||||||
[CPU_NICE_TEXT] = ColorPair(Cyan,Black),
|
[CPU_NICE_TEXT] = ColorPair(Cyan, Black),
|
||||||
[CPU_NORMAL] = ColorPair(Green,Black),
|
[CPU_NORMAL] = ColorPair(Green, Black),
|
||||||
[CPU_SYSTEM] = ColorPair(Red,Black),
|
[CPU_SYSTEM] = ColorPair(Red, Black),
|
||||||
[CPU_IOWAIT] = A_BOLD | ColorPair(Blue,Black),
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black),
|
[CPU_IRQ] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[CPU_SOFTIRQ] = ColorPair(Blue,Black),
|
[CPU_SOFTIRQ] = ColorPair(Blue, Black),
|
||||||
[CPU_STEAL] = ColorPair(Blue,Black),
|
[CPU_STEAL] = ColorPair(Blue, Black),
|
||||||
[CPU_GUEST] = ColorPair(Blue,Black),
|
[CPU_GUEST] = ColorPair(Blue, Black),
|
||||||
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Blue,Black),
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Blue, Black),
|
||||||
[PRESSURE_STALL_SIXTY] = ColorPair(Blue,Black),
|
[PRESSURE_STALL_SIXTY] = ColorPair(Blue, Black),
|
||||||
[PRESSURE_STALL_TEN] = ColorPair(Blue,Black),
|
[PRESSURE_STALL_TEN] = ColorPair(Blue, Black),
|
||||||
[ZFS_MFU] = ColorPair(Cyan,Black),
|
[ZFS_MFU] = ColorPair(Cyan, Black),
|
||||||
[ZFS_MRU] = ColorPair(Yellow,Black),
|
[ZFS_MRU] = ColorPair(Yellow, Black),
|
||||||
[ZFS_ANON] = A_BOLD | ColorPair(Magenta,Black),
|
[ZFS_ANON] = A_BOLD | ColorPair(Magenta, Black),
|
||||||
[ZFS_HEADER] = ColorPair(Blue,Black),
|
[ZFS_HEADER] = ColorPair(Blue, Black),
|
||||||
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta,Black),
|
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta, Black),
|
||||||
[ZFS_COMPRESSED] = ColorPair(Cyan,Black),
|
[ZFS_COMPRESSED] = ColorPair(Cyan, Black),
|
||||||
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta,Black),
|
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta, Black),
|
||||||
[ZRAM] = ColorPair(Yellow,Black),
|
[ZRAM] = ColorPair(Yellow, Black),
|
||||||
},
|
},
|
||||||
[COLORSCHEME_MIDNIGHT] = {
|
[COLORSCHEME_MIDNIGHT] = {
|
||||||
[RESET_COLOR] = ColorPair(White,Blue),
|
[RESET_COLOR] = ColorPair(White, Blue),
|
||||||
[DEFAULT_COLOR] = ColorPair(White,Blue),
|
[DEFAULT_COLOR] = ColorPair(White, Blue),
|
||||||
[FUNCTION_BAR] = ColorPair(Black,Cyan),
|
[FUNCTION_BAR] = ColorPair(Black, Cyan),
|
||||||
[FUNCTION_KEY] = A_NORMAL,
|
[FUNCTION_KEY] = A_NORMAL,
|
||||||
[PANEL_HEADER_FOCUS] = ColorPair(Black,Cyan),
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Cyan),
|
||||||
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Cyan),
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Cyan),
|
||||||
[PANEL_SELECTION_FOCUS] = ColorPair(Black,White),
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, White),
|
||||||
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
||||||
[PANEL_SELECTION_UNFOCUS] = A_BOLD | ColorPair(Yellow,Blue),
|
[PANEL_SELECTION_UNFOCUS] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[FAILED_SEARCH] = ColorPair(Red,Cyan),
|
[FAILED_SEARCH] = ColorPair(Red, Cyan),
|
||||||
[PAUSED] = A_BOLD | ColorPair(Yellow,Cyan),
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Cyan),
|
||||||
[UPTIME] = A_BOLD | ColorPair(Yellow,Blue),
|
[UPTIME] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[BATTERY] = A_BOLD | ColorPair(Yellow,Blue),
|
[BATTERY] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Blue),
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red, Blue),
|
||||||
[METER_TEXT] = ColorPair(Cyan,Blue),
|
[METER_TEXT] = ColorPair(Cyan, Blue),
|
||||||
[METER_VALUE] = A_BOLD | ColorPair(Cyan,Blue),
|
[METER_VALUE] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Blue),
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Blue),
|
||||||
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White,Blue),
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(White, Blue),
|
||||||
[METER_VALUE_IOREAD] = ColorPair(Green,Blue),
|
[METER_VALUE_IOREAD] = ColorPair(Green, Blue),
|
||||||
[METER_VALUE_IOWRITE] = ColorPair(Black,Blue),
|
[METER_VALUE_IOWRITE] = ColorPair(Black, Blue),
|
||||||
[LED_COLOR] = ColorPair(Green,Blue),
|
[LED_COLOR] = ColorPair(Green, Blue),
|
||||||
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Blue),
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green, Blue),
|
||||||
[PROCESS] = ColorPair(White,Blue),
|
[PROCESS] = ColorPair(White, Blue),
|
||||||
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black,Blue),
|
[PROCESS_SHADOW] = A_BOLD | ColorPair(Black, Blue),
|
||||||
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Blue),
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[PROCESS_MEGABYTES] = ColorPair(Cyan,Blue),
|
[PROCESS_MEGABYTES] = ColorPair(Cyan, Blue),
|
||||||
[PROCESS_GIGABYTES] = ColorPair(Green,Blue),
|
[PROCESS_GIGABYTES] = ColorPair(Green, Blue),
|
||||||
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan,Blue),
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[PROCESS_TREE] = ColorPair(Cyan,Blue),
|
[PROCESS_TREE] = ColorPair(Cyan, Blue),
|
||||||
[PROCESS_R_STATE] = ColorPair(Green,Blue),
|
[PROCESS_R_STATE] = ColorPair(Green, Blue),
|
||||||
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Blue),
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Blue),
|
||||||
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Blue),
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Blue),
|
||||||
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Blue),
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Blue),
|
||||||
[PROCESS_THREAD] = ColorPair(Green,Blue),
|
[PROCESS_THREAD] = ColorPair(Green, Blue),
|
||||||
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green,Blue),
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Green, Blue),
|
||||||
[BAR_BORDER] = A_BOLD | ColorPair(Yellow,Blue),
|
[BAR_BORDER] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[BAR_SHADOW] = ColorPair(Cyan,Blue),
|
[BAR_SHADOW] = ColorPair(Cyan, Blue),
|
||||||
[SWAP] = ColorPair(Red,Blue),
|
[SWAP] = ColorPair(Red, Blue),
|
||||||
[GRAPH_1] = A_BOLD | ColorPair(Cyan,Blue),
|
[GRAPH_1] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[GRAPH_2] = ColorPair(Cyan,Blue),
|
[GRAPH_2] = ColorPair(Cyan, Blue),
|
||||||
[MEMORY_USED] = A_BOLD | ColorPair(Green,Blue),
|
[MEMORY_USED] = A_BOLD | ColorPair(Green, Blue),
|
||||||
[MEMORY_BUFFERS] = A_BOLD | ColorPair(Cyan,Blue),
|
[MEMORY_BUFFERS] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Cyan,Blue),
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[MEMORY_CACHE] = A_BOLD | ColorPair(Yellow,Blue),
|
[MEMORY_CACHE] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black,Blue),
|
[LOAD_AVERAGE_FIFTEEN] = A_BOLD | ColorPair(Black, Blue),
|
||||||
[LOAD_AVERAGE_FIVE] = A_NORMAL | ColorPair(White,Blue),
|
[LOAD_AVERAGE_FIVE] = A_NORMAL | ColorPair(White, Blue),
|
||||||
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White,Blue),
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(White, Blue),
|
||||||
[LOAD] = A_BOLD | ColorPair(White,Blue),
|
[LOAD] = A_BOLD | ColorPair(White, Blue),
|
||||||
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Blue),
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[CLOCK] = ColorPair(White,Blue),
|
[CLOCK] = ColorPair(White, Blue),
|
||||||
[DATE] = ColorPair(White,Blue),
|
[DATE] = ColorPair(White, Blue),
|
||||||
[DATETIME] = ColorPair(White,Blue),
|
[DATETIME] = ColorPair(White, Blue),
|
||||||
[CHECK_BOX] = ColorPair(Cyan,Blue),
|
[CHECK_BOX] = ColorPair(Cyan, Blue),
|
||||||
[CHECK_MARK] = A_BOLD | ColorPair(White,Blue),
|
[CHECK_MARK] = A_BOLD | ColorPair(White, Blue),
|
||||||
[CHECK_TEXT] = A_NORMAL | ColorPair(White,Blue),
|
[CHECK_TEXT] = A_NORMAL | ColorPair(White, Blue),
|
||||||
[HOSTNAME] = ColorPair(White,Blue),
|
[HOSTNAME] = ColorPair(White, Blue),
|
||||||
[CPU_NICE] = A_BOLD | ColorPair(Cyan,Blue),
|
[CPU_NICE] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Cyan,Blue),
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Cyan, Blue),
|
||||||
[CPU_NORMAL] = A_BOLD | ColorPair(Green,Blue),
|
[CPU_NORMAL] = A_BOLD | ColorPair(Green, Blue),
|
||||||
[CPU_SYSTEM] = A_BOLD | ColorPair(Red,Blue),
|
[CPU_SYSTEM] = A_BOLD | ColorPair(Red, Blue),
|
||||||
[CPU_IOWAIT] = A_BOLD | ColorPair(Black,Blue),
|
[CPU_IOWAIT] = A_BOLD | ColorPair(Black, Blue),
|
||||||
[CPU_IRQ] = A_BOLD | ColorPair(Black,Blue),
|
[CPU_IRQ] = A_BOLD | ColorPair(Black, Blue),
|
||||||
[CPU_SOFTIRQ] = ColorPair(Black,Blue),
|
[CPU_SOFTIRQ] = ColorPair(Black, Blue),
|
||||||
[CPU_STEAL] = ColorPair(White,Blue),
|
[CPU_STEAL] = ColorPair(White, Blue),
|
||||||
[CPU_GUEST] = ColorPair(White,Blue),
|
[CPU_GUEST] = ColorPair(White, Blue),
|
||||||
[PRESSURE_STALL_THREEHUNDRED] = A_BOLD | ColorPair(Black,Blue),
|
[PRESSURE_STALL_THREEHUNDRED] = A_BOLD | ColorPair(Black, Blue),
|
||||||
[PRESSURE_STALL_SIXTY] = A_NORMAL | ColorPair(White,Blue),
|
[PRESSURE_STALL_SIXTY] = A_NORMAL | ColorPair(White, Blue),
|
||||||
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White,Blue),
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(White, Blue),
|
||||||
[ZFS_MFU] = A_BOLD | ColorPair(White,Blue),
|
[ZFS_MFU] = A_BOLD | ColorPair(White, Blue),
|
||||||
[ZFS_MRU] = A_BOLD | ColorPair(Yellow,Blue),
|
[ZFS_MRU] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[ZFS_ANON] = A_BOLD | ColorPair(Magenta,Blue),
|
[ZFS_ANON] = A_BOLD | ColorPair(Magenta, Blue),
|
||||||
[ZFS_HEADER] = A_BOLD | ColorPair(Yellow,Blue),
|
[ZFS_HEADER] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta,Blue),
|
[ZFS_OTHER] = A_BOLD | ColorPair(Magenta, Blue),
|
||||||
[ZFS_COMPRESSED] = A_BOLD | ColorPair(White,Blue),
|
[ZFS_COMPRESSED] = A_BOLD | ColorPair(White, Blue),
|
||||||
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta,Blue),
|
[ZFS_RATIO] = A_BOLD | ColorPair(Magenta, Blue),
|
||||||
[ZRAM] = A_BOLD | ColorPair(Yellow,Blue),
|
[ZRAM] = A_BOLD | ColorPair(Yellow, Blue),
|
||||||
},
|
},
|
||||||
[COLORSCHEME_BLACKNIGHT] = {
|
[COLORSCHEME_BLACKNIGHT] = {
|
||||||
[RESET_COLOR] = ColorPair(Cyan,Black),
|
[RESET_COLOR] = ColorPair(Cyan, Black),
|
||||||
[DEFAULT_COLOR] = ColorPair(Cyan,Black),
|
[DEFAULT_COLOR] = ColorPair(Cyan, Black),
|
||||||
[FUNCTION_BAR] = ColorPair(Black,Green),
|
[FUNCTION_BAR] = ColorPair(Black, Green),
|
||||||
[FUNCTION_KEY] = ColorPair(Cyan,Black),
|
[FUNCTION_KEY] = ColorPair(Cyan, Black),
|
||||||
[PANEL_HEADER_FOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_FOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_HEADER_UNFOCUS] = ColorPair(Black,Green),
|
[PANEL_HEADER_UNFOCUS] = ColorPair(Black, Green),
|
||||||
[PANEL_SELECTION_FOCUS] = ColorPair(Black,Cyan),
|
[PANEL_SELECTION_FOCUS] = ColorPair(Black, Cyan),
|
||||||
[PANEL_SELECTION_FOLLOW] = ColorPair(Black,Yellow),
|
[PANEL_SELECTION_FOLLOW] = ColorPair(Black, Yellow),
|
||||||
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black,White),
|
[PANEL_SELECTION_UNFOCUS] = ColorPair(Black, White),
|
||||||
[FAILED_SEARCH] = ColorPair(Red,Green),
|
[FAILED_SEARCH] = ColorPair(Red, Green),
|
||||||
[PAUSED] = A_BOLD | ColorPair(Yellow,Green),
|
[PAUSED] = A_BOLD | ColorPair(Yellow, Green),
|
||||||
[UPTIME] = ColorPair(Green,Black),
|
[UPTIME] = ColorPair(Green, Black),
|
||||||
[BATTERY] = ColorPair(Green,Black),
|
[BATTERY] = ColorPair(Green, Black),
|
||||||
[LARGE_NUMBER] = A_BOLD | ColorPair(Red,Black),
|
[LARGE_NUMBER] = A_BOLD | ColorPair(Red, Black),
|
||||||
[METER_TEXT] = ColorPair(Cyan,Black),
|
[METER_TEXT] = ColorPair(Cyan, Black),
|
||||||
[METER_VALUE] = ColorPair(Green,Black),
|
[METER_VALUE] = ColorPair(Green, Black),
|
||||||
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red,Black),
|
[METER_VALUE_ERROR] = A_BOLD | ColorPair(Red, Black),
|
||||||
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow,Black),
|
[METER_VALUE_NOTICE] = A_BOLD | ColorPair(Yellow, Black),
|
||||||
[METER_VALUE_IOREAD] = ColorPair(Green,Black),
|
[METER_VALUE_IOREAD] = ColorPair(Green, Black),
|
||||||
[METER_VALUE_IOWRITE] = ColorPair(Blue,Black),
|
[METER_VALUE_IOWRITE] = ColorPair(Blue, Black),
|
||||||
[LED_COLOR] = ColorPair(Green,Black),
|
[LED_COLOR] = ColorPair(Green, Black),
|
||||||
[TASKS_RUNNING] = A_BOLD | ColorPair(Green,Black),
|
[TASKS_RUNNING] = A_BOLD | ColorPair(Green, Black),
|
||||||
[PROCESS] = ColorPair(Cyan,Black),
|
[PROCESS] = ColorPair(Cyan, Black),
|
||||||
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
[PROCESS_SHADOW] = A_BOLD | ColorPairGrayBlack,
|
||||||
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow,Black),
|
[PROCESS_TAG] = A_BOLD | ColorPair(Yellow, Black),
|
||||||
[PROCESS_MEGABYTES] = A_BOLD | ColorPair(Green,Black),
|
[PROCESS_MEGABYTES] = A_BOLD | ColorPair(Green, Black),
|
||||||
[PROCESS_GIGABYTES] = A_BOLD | ColorPair(Yellow,Black),
|
[PROCESS_GIGABYTES] = A_BOLD | ColorPair(Yellow, Black),
|
||||||
[PROCESS_BASENAME] = A_BOLD | ColorPair(Green,Black),
|
[PROCESS_BASENAME] = A_BOLD | ColorPair(Green, Black),
|
||||||
[PROCESS_TREE] = ColorPair(Cyan,Black),
|
[PROCESS_TREE] = ColorPair(Cyan, Black),
|
||||||
[PROCESS_THREAD] = ColorPair(Green,Black),
|
[PROCESS_THREAD] = ColorPair(Green, Black),
|
||||||
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue,Black),
|
[PROCESS_THREAD_BASENAME] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[PROCESS_R_STATE] = ColorPair(Green,Black),
|
[PROCESS_R_STATE] = ColorPair(Green, Black),
|
||||||
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red,Black),
|
[PROCESS_D_STATE] = A_BOLD | ColorPair(Red, Black),
|
||||||
[PROCESS_HIGH_PRIORITY] = ColorPair(Red,Black),
|
[PROCESS_HIGH_PRIORITY] = ColorPair(Red, Black),
|
||||||
[PROCESS_LOW_PRIORITY] = ColorPair(Green,Black),
|
[PROCESS_LOW_PRIORITY] = ColorPair(Green, Black),
|
||||||
[BAR_BORDER] = A_BOLD | ColorPair(Green,Black),
|
[BAR_BORDER] = A_BOLD | ColorPair(Green, Black),
|
||||||
[BAR_SHADOW] = ColorPair(Cyan,Black),
|
[BAR_SHADOW] = ColorPair(Cyan, Black),
|
||||||
[SWAP] = ColorPair(Red,Black),
|
[SWAP] = ColorPair(Red, Black),
|
||||||
[GRAPH_1] = A_BOLD | ColorPair(Green,Black),
|
[GRAPH_1] = A_BOLD | ColorPair(Green, Black),
|
||||||
[GRAPH_2] = ColorPair(Green,Black),
|
[GRAPH_2] = ColorPair(Green, Black),
|
||||||
[MEMORY_USED] = ColorPair(Green,Black),
|
[MEMORY_USED] = ColorPair(Green, Black),
|
||||||
[MEMORY_BUFFERS] = ColorPair(Blue,Black),
|
[MEMORY_BUFFERS] = ColorPair(Blue, Black),
|
||||||
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
[MEMORY_BUFFERS_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[MEMORY_CACHE] = ColorPair(Yellow,Black),
|
[MEMORY_CACHE] = ColorPair(Yellow, Black),
|
||||||
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green,Black),
|
[LOAD_AVERAGE_FIFTEEN] = ColorPair(Green, Black),
|
||||||
[LOAD_AVERAGE_FIVE] = ColorPair(Green,Black),
|
[LOAD_AVERAGE_FIVE] = ColorPair(Green, Black),
|
||||||
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(Green,Black),
|
[LOAD_AVERAGE_ONE] = A_BOLD | ColorPair(Green, Black),
|
||||||
[LOAD] = A_BOLD,
|
[LOAD] = A_BOLD,
|
||||||
[HELP_BOLD] = A_BOLD | ColorPair(Cyan,Black),
|
[HELP_BOLD] = A_BOLD | ColorPair(Cyan, Black),
|
||||||
[CLOCK] = ColorPair(Green,Black),
|
[CLOCK] = ColorPair(Green, Black),
|
||||||
[CHECK_BOX] = ColorPair(Green,Black),
|
[CHECK_BOX] = ColorPair(Green, Black),
|
||||||
[CHECK_MARK] = A_BOLD | ColorPair(Green,Black),
|
[CHECK_MARK] = A_BOLD | ColorPair(Green, Black),
|
||||||
[CHECK_TEXT] = ColorPair(Cyan,Black),
|
[CHECK_TEXT] = ColorPair(Cyan, Black),
|
||||||
[HOSTNAME] = ColorPair(Green,Black),
|
[HOSTNAME] = ColorPair(Green, Black),
|
||||||
[CPU_NICE] = ColorPair(Blue,Black),
|
[CPU_NICE] = ColorPair(Blue, Black),
|
||||||
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue,Black),
|
[CPU_NICE_TEXT] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[CPU_NORMAL] = ColorPair(Green,Black),
|
[CPU_NORMAL] = ColorPair(Green, Black),
|
||||||
[CPU_SYSTEM] = ColorPair(Red,Black),
|
[CPU_SYSTEM] = ColorPair(Red, Black),
|
||||||
[CPU_IOWAIT] = ColorPair(Yellow,Black),
|
[CPU_IOWAIT] = ColorPair(Yellow, Black),
|
||||||
[CPU_IRQ] = A_BOLD | ColorPair(Blue,Black),
|
[CPU_IRQ] = A_BOLD | ColorPair(Blue, Black),
|
||||||
[CPU_SOFTIRQ] = ColorPair(Blue,Black),
|
[CPU_SOFTIRQ] = ColorPair(Blue, Black),
|
||||||
[CPU_STEAL] = ColorPair(Cyan,Black),
|
[CPU_STEAL] = ColorPair(Cyan, Black),
|
||||||
[CPU_GUEST] = ColorPair(Cyan,Black),
|
[CPU_GUEST] = ColorPair(Cyan, Black),
|
||||||
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Green,Black),
|
[PRESSURE_STALL_THREEHUNDRED] = ColorPair(Green, Black),
|
||||||
[PRESSURE_STALL_SIXTY] = ColorPair(Green,Black),
|
[PRESSURE_STALL_SIXTY] = ColorPair(Green, Black),
|
||||||
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(Green,Black),
|
[PRESSURE_STALL_TEN] = A_BOLD | ColorPair(Green, Black),
|
||||||
[ZFS_MFU] = ColorPair(Blue,Black),
|
[ZFS_MFU] = ColorPair(Blue, Black),
|
||||||
[ZFS_MRU] = ColorPair(Yellow,Black),
|
[ZFS_MRU] = ColorPair(Yellow, Black),
|
||||||
[ZFS_ANON] = ColorPair(Magenta,Black),
|
[ZFS_ANON] = ColorPair(Magenta, Black),
|
||||||
[ZFS_HEADER] = ColorPair(Yellow,Black),
|
[ZFS_HEADER] = ColorPair(Yellow, Black),
|
||||||
[ZFS_OTHER] = ColorPair(Magenta,Black),
|
[ZFS_OTHER] = ColorPair(Magenta, Black),
|
||||||
[ZFS_COMPRESSED] = ColorPair(Blue,Black),
|
[ZFS_COMPRESSED] = ColorPair(Blue, Black),
|
||||||
[ZFS_RATIO] = ColorPair(Magenta,Black),
|
[ZFS_RATIO] = ColorPair(Magenta, Black),
|
||||||
[ZRAM] = ColorPair(Yellow,Black),
|
[ZRAM] = ColorPair(Yellow, Black),
|
||||||
},
|
},
|
||||||
[COLORSCHEME_BROKENGRAY] = { 0 } // dynamically generated.
|
[COLORSCHEME_BROKENGRAY] = { 0 } // dynamically generated.
|
||||||
};
|
};
|
||||||
|
@ -610,7 +610,7 @@ void CRT_init(int delay, int colorScheme, bool allowUnicode) {
|
||||||
|
|
||||||
for (int i = 0; i < LAST_COLORELEMENT; i++) {
|
for (int i = 0; i < LAST_COLORELEMENT; i++) {
|
||||||
unsigned int color = CRT_colorSchemes[COLORSCHEME_DEFAULT][i];
|
unsigned int color = CRT_colorSchemes[COLORSCHEME_DEFAULT][i];
|
||||||
CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPairGrayBlack) ? ColorPair(White,Black) : color;
|
CRT_colorSchemes[COLORSCHEME_BROKENGRAY][i] = color == (A_BOLD | ColorPairGrayBlack) ? ColorPair(White, Black) : color;
|
||||||
}
|
}
|
||||||
|
|
||||||
halfdelay(CRT_delay);
|
halfdelay(CRT_delay);
|
||||||
|
@ -649,7 +649,7 @@ void CRT_init(int delay, int colorScheme, bool allowUnicode) {
|
||||||
|
|
||||||
struct sigaction act;
|
struct sigaction act;
|
||||||
sigemptyset (&act.sa_mask);
|
sigemptyset (&act.sa_mask);
|
||||||
act.sa_flags = (int)SA_RESETHAND|SA_NODEFER;
|
act.sa_flags = (int)SA_RESETHAND | SA_NODEFER;
|
||||||
act.sa_handler = CRT_handleSIGSEGV;
|
act.sa_handler = CRT_handleSIGSEGV;
|
||||||
sigaction (SIGSEGV, &act, &old_sig_handler[SIGSEGV]);
|
sigaction (SIGSEGV, &act, &old_sig_handler[SIGSEGV]);
|
||||||
sigaction (SIGFPE, &act, &old_sig_handler[SIGFPE]);
|
sigaction (SIGFPE, &act, &old_sig_handler[SIGFPE]);
|
||||||
|
@ -732,11 +732,11 @@ void CRT_setColors(int colorScheme) {
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
for (int j = 0; j < 8; j++) {
|
for (int j = 0; j < 8; j++) {
|
||||||
if (ColorIndex(i,j) != ColorPairGrayBlack) {
|
if (ColorIndex(i, j) != ColorPairGrayBlack) {
|
||||||
int bg = (colorScheme != COLORSCHEME_BLACKNIGHT)
|
int bg = (colorScheme != COLORSCHEME_BLACKNIGHT)
|
||||||
? (j==0 ? -1 : j)
|
? (j == 0 ? -1 : j)
|
||||||
: j;
|
: j;
|
||||||
init_pair(ColorIndex(i,j), i, bg);
|
init_pair(ColorIndex(i, j), i, bg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
2
CRT.h
2
CRT.h
|
@ -133,7 +133,7 @@ extern bool CRT_utf8;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const char *const *CRT_treeStr;
|
extern const char* const* CRT_treeStr;
|
||||||
|
|
||||||
extern int CRT_delay;
|
extern int CRT_delay;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ static const int ClockMeter_attributes[] = {
|
||||||
static void ClockMeter_updateValues(Meter* this, char* buffer, int size) {
|
static void ClockMeter_updateValues(Meter* this, char* buffer, int size) {
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm result;
|
struct tm result;
|
||||||
struct tm *lt = localtime_r(&t, &result);
|
struct tm* lt = localtime_r(&t, &result);
|
||||||
this->values[0] = lt->tm_hour * 60 + lt->tm_min;
|
this->values[0] = lt->tm_hour * 60 + lt->tm_min;
|
||||||
strftime(buffer, size, "%H:%M:%S", lt);
|
strftime(buffer, size, "%H:%M:%S", lt);
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ void ColumnsPanel_update(Panel* super) {
|
||||||
ColumnsPanel* this = (ColumnsPanel*) super;
|
ColumnsPanel* this = (ColumnsPanel*) super;
|
||||||
int size = Panel_size(super);
|
int size = Panel_size(super);
|
||||||
this->settings->changed = true;
|
this->settings->changed = true;
|
||||||
this->settings->fields = xRealloc(this->settings->fields, sizeof(ProcessField) * (size+1));
|
this->settings->fields = xRealloc(this->settings->fields, sizeof(ProcessField) * (size + 1));
|
||||||
this->settings->flags = 0;
|
this->settings->flags = 0;
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
int key = ((ListItem*) Panel_get(super, i))->key;
|
int key = ((ListItem*) Panel_get(super, i))->key;
|
||||||
|
|
|
@ -22,10 +22,10 @@ static const int DateMeter_attributes[] = {
|
||||||
static void DateMeter_updateValues(Meter* this, char* buffer, int size) {
|
static void DateMeter_updateValues(Meter* this, char* buffer, int size) {
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm result;
|
struct tm result;
|
||||||
struct tm *lt = localtime_r(&t, &result);
|
struct tm* lt = localtime_r(&t, &result);
|
||||||
this->values[0] = lt->tm_yday;
|
this->values[0] = lt->tm_yday;
|
||||||
int year = lt->tm_year + 1900;
|
int year = lt->tm_year + 1900;
|
||||||
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0)) {
|
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
|
||||||
this->total = 366;
|
this->total = 366;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -22,9 +22,9 @@ static const int DateTimeMeter_attributes[] = {
|
||||||
static void DateTimeMeter_updateValues(Meter* this, char* buffer, int size) {
|
static void DateTimeMeter_updateValues(Meter* this, char* buffer, int size) {
|
||||||
time_t t = time(NULL);
|
time_t t = time(NULL);
|
||||||
struct tm result;
|
struct tm result;
|
||||||
struct tm *lt = localtime_r(&t, &result);
|
struct tm* lt = localtime_r(&t, &result);
|
||||||
int year = lt->tm_year + 1900;
|
int year = lt->tm_year + 1900;
|
||||||
if (((year % 4 == 0) && (year % 100!= 0)) || (year%400 == 0)) {
|
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) {
|
||||||
this->total = 366;
|
this->total = 366;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -26,7 +26,7 @@ const InfoScreenClass EnvScreen_class = {
|
||||||
EnvScreen* EnvScreen_new(Process* process) {
|
EnvScreen* EnvScreen_new(Process* process) {
|
||||||
EnvScreen* this = xMalloc(sizeof(EnvScreen));
|
EnvScreen* this = xMalloc(sizeof(EnvScreen));
|
||||||
Object_setClass(this, Class(EnvScreen));
|
Object_setClass(this, Class(EnvScreen));
|
||||||
return (EnvScreen*) InfoScreen_init(&this->super, process, NULL, LINES-3, " ");
|
return (EnvScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 3, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EnvScreen_delete(Object* this) {
|
void EnvScreen_delete(Object* this) {
|
||||||
|
@ -47,7 +47,7 @@ void EnvScreen_scan(InfoScreen* this) {
|
||||||
char* env = Platform_getProcessEnv(this->process->pid);
|
char* env = Platform_getProcessEnv(this->process->pid);
|
||||||
CRT_restorePrivileges();
|
CRT_restorePrivileges();
|
||||||
if (env) {
|
if (env) {
|
||||||
for (char *p = env; *p; p = strrchr(p, 0)+1)
|
for (char* p = env; *p; p = strrchr(p, 0) + 1)
|
||||||
InfoScreen_addLine(this, p);
|
InfoScreen_addLine(this, p);
|
||||||
free(env);
|
free(env);
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,14 +94,14 @@ void FunctionBar_draw(const FunctionBar* this) {
|
||||||
|
|
||||||
void FunctionBar_drawExtra(const FunctionBar* this, const char* buffer, int attr, bool setCursor) {
|
void FunctionBar_drawExtra(const FunctionBar* this, const char* buffer, int attr, bool setCursor) {
|
||||||
attrset(CRT_colors[FUNCTION_BAR]);
|
attrset(CRT_colors[FUNCTION_BAR]);
|
||||||
mvhline(LINES-1, 0, ' ', COLS);
|
mvhline(LINES - 1, 0, ' ', COLS);
|
||||||
int x = 0;
|
int x = 0;
|
||||||
for (int i = 0; i < this->size; i++) {
|
for (int i = 0; i < this->size; i++) {
|
||||||
attrset(CRT_colors[FUNCTION_KEY]);
|
attrset(CRT_colors[FUNCTION_KEY]);
|
||||||
mvaddstr(LINES-1, x, this->keys.constKeys[i]);
|
mvaddstr(LINES - 1, x, this->keys.constKeys[i]);
|
||||||
x += strlen(this->keys.constKeys[i]);
|
x += strlen(this->keys.constKeys[i]);
|
||||||
attrset(CRT_colors[FUNCTION_BAR]);
|
attrset(CRT_colors[FUNCTION_BAR]);
|
||||||
mvaddstr(LINES-1, x, this->functions[i]);
|
mvaddstr(LINES - 1, x, this->functions[i]);
|
||||||
x += strlen(this->functions[i]);
|
x += strlen(this->functions[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ void FunctionBar_drawExtra(const FunctionBar* this, const char* buffer, int attr
|
||||||
attrset(CRT_colors[FUNCTION_BAR]);
|
attrset(CRT_colors[FUNCTION_BAR]);
|
||||||
else
|
else
|
||||||
attrset(attr);
|
attrset(attr);
|
||||||
mvaddstr(LINES-1, x, buffer);
|
mvaddstr(LINES - 1, x, buffer);
|
||||||
attrset(CRT_colors[RESET_COLOR]);
|
attrset(CRT_colors[RESET_COLOR]);
|
||||||
x += strlen(buffer);
|
x += strlen(buffer);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ void FunctionBar_append(const char* buffer, int attr) {
|
||||||
attrset(CRT_colors[FUNCTION_BAR]);
|
attrset(CRT_colors[FUNCTION_BAR]);
|
||||||
else
|
else
|
||||||
attrset(attr);
|
attrset(attr);
|
||||||
mvaddstr(LINES-1, currentLen, buffer);
|
mvaddstr(LINES - 1, currentLen, buffer);
|
||||||
attrset(CRT_colors[RESET_COLOR]);
|
attrset(CRT_colors[RESET_COLOR]);
|
||||||
|
|
||||||
currentLen += strlen(buffer);
|
currentLen += strlen(buffer);
|
||||||
|
|
2
Header.c
2
Header.c
|
@ -63,7 +63,7 @@ void Header_writeBackToSettings(const Header* this) {
|
||||||
Vector* vec = this->columns[col];
|
Vector* vec = this->columns[col];
|
||||||
int len = Vector_size(vec);
|
int len = Vector_size(vec);
|
||||||
|
|
||||||
colSettings->names = xCalloc(len+1, sizeof(char*));
|
colSettings->names = xCalloc(len + 1, sizeof(char*));
|
||||||
colSettings->modes = xCalloc(len, sizeof(int));
|
colSettings->modes = xCalloc(len, sizeof(int));
|
||||||
colSettings->len = len;
|
colSettings->len = len;
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ static const int HostnameMeter_attributes[] = {
|
||||||
|
|
||||||
static void HostnameMeter_updateValues(Meter* this, char* buffer, int size) {
|
static void HostnameMeter_updateValues(Meter* this, char* buffer, int size) {
|
||||||
(void) this;
|
(void) this;
|
||||||
gethostname(buffer, size-1);
|
gethostname(buffer, size - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const MeterClass HostnameMeter_class = {
|
const MeterClass HostnameMeter_class = {
|
||||||
|
|
2
IncSet.h
2
IncSet.h
|
@ -22,7 +22,7 @@ typedef enum {
|
||||||
} IncType;
|
} IncType;
|
||||||
|
|
||||||
typedef struct IncMode_ {
|
typedef struct IncMode_ {
|
||||||
char buffer[INCMODE_MAX+1];
|
char buffer[INCMODE_MAX + 1];
|
||||||
int index;
|
int index;
|
||||||
FunctionBar* bar;
|
FunctionBar* bar;
|
||||||
bool isFilter;
|
bool isFilter;
|
||||||
|
|
17
InfoScreen.c
17
InfoScreen.c
|
@ -65,21 +65,23 @@ void InfoScreen_addLine(InfoScreen* this, const char* line) {
|
||||||
Vector_add(this->lines, (Object*) ListItem_new(line, 0));
|
Vector_add(this->lines, (Object*) ListItem_new(line, 0));
|
||||||
const char* incFilter = IncSet_filter(this->inc);
|
const char* incFilter = IncSet_filter(this->inc);
|
||||||
if (!incFilter || String_contains_i(line, incFilter))
|
if (!incFilter || String_contains_i(line, incFilter))
|
||||||
Panel_add(this->display, Vector_get(this->lines, Vector_size(this->lines)-1));
|
Panel_add(this->display, Vector_get(this->lines, Vector_size(this->lines) - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoScreen_appendLine(InfoScreen* this, const char* line) {
|
void InfoScreen_appendLine(InfoScreen* this, const char* line) {
|
||||||
ListItem* last = (ListItem*)Vector_get(this->lines, Vector_size(this->lines)-1);
|
ListItem* last = (ListItem*)Vector_get(this->lines, Vector_size(this->lines) - 1);
|
||||||
ListItem_append(last, line);
|
ListItem_append(last, line);
|
||||||
const char* incFilter = IncSet_filter(this->inc);
|
const char* incFilter = IncSet_filter(this->inc);
|
||||||
if (incFilter && Panel_get(this->display, Panel_size(this->display)-1) != (Object*)last && String_contains_i(line, incFilter))
|
if (incFilter && Panel_get(this->display, Panel_size(this->display) - 1) != (Object*)last && String_contains_i(line, incFilter))
|
||||||
Panel_add(this->display, (Object*)last);
|
Panel_add(this->display, (Object*)last);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoScreen_run(InfoScreen* this) {
|
void InfoScreen_run(InfoScreen* this) {
|
||||||
Panel* panel = this->display;
|
Panel* panel = this->display;
|
||||||
|
|
||||||
if (As_InfoScreen(this)->scan) InfoScreen_scan(this);
|
if (As_InfoScreen(this)->scan)
|
||||||
|
InfoScreen_scan(this);
|
||||||
|
|
||||||
InfoScreen_draw(this);
|
InfoScreen_draw(this);
|
||||||
|
|
||||||
bool looping = true;
|
bool looping = true;
|
||||||
|
@ -88,7 +90,7 @@ void InfoScreen_run(InfoScreen* this) {
|
||||||
Panel_draw(panel, true);
|
Panel_draw(panel, true);
|
||||||
|
|
||||||
if (this->inc->active) {
|
if (this->inc->active) {
|
||||||
(void) move(LINES-1, CRT_cursorX);
|
(void) move(LINES - 1, CRT_cursorX);
|
||||||
}
|
}
|
||||||
set_escdelay(25);
|
set_escdelay(25);
|
||||||
int ch = getch();
|
int ch = getch();
|
||||||
|
@ -144,8 +146,9 @@ void InfoScreen_run(InfoScreen* this) {
|
||||||
looping = false;
|
looping = false;
|
||||||
break;
|
break;
|
||||||
case KEY_RESIZE:
|
case KEY_RESIZE:
|
||||||
Panel_resize(panel, COLS, LINES-2);
|
Panel_resize(panel, COLS, LINES - 2);
|
||||||
if (As_InfoScreen(this)->scan) InfoScreen_scan(this);
|
if (As_InfoScreen(this)->scan)
|
||||||
|
InfoScreen_scan(this);
|
||||||
InfoScreen_draw(this);
|
InfoScreen_draw(this);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -36,7 +36,7 @@ void MainPanel_updateTreeFunctions(MainPanel* this, bool mode) {
|
||||||
|
|
||||||
void MainPanel_pidSearch(MainPanel* this, int ch) {
|
void MainPanel_pidSearch(MainPanel* this, int ch) {
|
||||||
Panel* super = (Panel*) this;
|
Panel* super = (Panel*) this;
|
||||||
pid_t pid = ch-48 + this->pidSearch;
|
pid_t pid = ch - 48 + this->pidSearch;
|
||||||
for (int i = 0; i < Panel_size(super); i++) {
|
for (int i = 0; i < Panel_size(super); i++) {
|
||||||
Process* p = (Process*) Panel_get(super, i);
|
Process* p = (Process*) Panel_get(super, i);
|
||||||
if (p && p->pid == pid) {
|
if (p && p->pid == pid) {
|
||||||
|
@ -153,7 +153,9 @@ bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Ar
|
||||||
}
|
}
|
||||||
if (!anyTagged) {
|
if (!anyTagged) {
|
||||||
Process* p = (Process*) Panel_getSelected(super);
|
Process* p = (Process*) Panel_getSelected(super);
|
||||||
if (p) ok = fn(p, arg) && ok;
|
if (p) {
|
||||||
|
ok &= fn(p, arg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (wasAnyTagged)
|
if (wasAnyTagged)
|
||||||
*wasAnyTagged = anyTagged;
|
*wasAnyTagged = anyTagged;
|
||||||
|
|
|
@ -24,7 +24,7 @@ typedef struct MainPanel_ {
|
||||||
Panel super;
|
Panel super;
|
||||||
State* state;
|
State* state;
|
||||||
IncSet* inc;
|
IncSet* inc;
|
||||||
Htop_Action *keys;
|
Htop_Action* keys;
|
||||||
pid_t pidSearch;
|
pid_t pidSearch;
|
||||||
} MainPanel;
|
} MainPanel;
|
||||||
|
|
||||||
|
|
36
Meter.c
36
Meter.c
|
@ -48,7 +48,7 @@ Meter* Meter_new(const struct ProcessList_* pl, int param, const MeterClass* typ
|
||||||
}
|
}
|
||||||
|
|
||||||
int Meter_humanUnit(char* buffer, unsigned long int value, int size) {
|
int Meter_humanUnit(char* buffer, unsigned long int value, int size) {
|
||||||
const char * prefix = "KMGTPEZY";
|
const char* prefix = "KMGTPEZY";
|
||||||
unsigned long int powi = 1;
|
unsigned long int powi = 1;
|
||||||
unsigned int written, powj = 1, precision = 2;
|
unsigned int written, powj = 1, precision = 2;
|
||||||
|
|
||||||
|
@ -199,7 +199,7 @@ static void BarMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
double value = this->values[i];
|
double value = this->values[i];
|
||||||
value = CLAMP(value, 0.0, this->total);
|
value = CLAMP(value, 0.0, this->total);
|
||||||
if (value > 0) {
|
if (value > 0) {
|
||||||
blockSizes[i] = ceil((value/this->total) * w);
|
blockSizes[i] = ceil((value / this->total) * w);
|
||||||
} else {
|
} else {
|
||||||
blockSizes[i] = 0;
|
blockSizes[i] = 0;
|
||||||
}
|
}
|
||||||
|
@ -285,11 +285,11 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
struct timeval now;
|
struct timeval now;
|
||||||
gettimeofday(&now, NULL);
|
gettimeofday(&now, NULL);
|
||||||
if (!timercmp(&now, &(data->time), <)) {
|
if (!timercmp(&now, &(data->time), <)) {
|
||||||
struct timeval delay = { .tv_sec = CRT_delay/10, .tv_usec = (CRT_delay-((CRT_delay/10)*10)) * 100000 };
|
struct timeval delay = { .tv_sec = CRT_delay / 10, .tv_usec = (CRT_delay - ((CRT_delay / 10) * 10)) * 100000 };
|
||||||
timeradd(&now, &delay, &(data->time));
|
timeradd(&now, &delay, &(data->time));
|
||||||
|
|
||||||
for (int i = 0; i < nValues - 1; i++)
|
for (int i = 0; i < nValues - 1; i++)
|
||||||
data->values[i] = data->values[i+1];
|
data->values[i] = data->values[i + 1];
|
||||||
|
|
||||||
char buffer[nValues];
|
char buffer[nValues];
|
||||||
Meter_updateValues(this, buffer, nValues - 1);
|
Meter_updateValues(this, buffer, nValues - 1);
|
||||||
|
@ -301,15 +301,15 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
data->values[nValues - 1] = value;
|
data->values[nValues - 1] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
int i = nValues - (w*2) + 2, k = 0;
|
int i = nValues - (w * 2) + 2, k = 0;
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
k = -i/2;
|
k = -i / 2;
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
for (; i < nValues - 1; i+=2, k++) {
|
for (; i < nValues - 1; i += 2, k++) {
|
||||||
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
int pix = GraphMeterMode_pixPerRow * GRAPH_HEIGHT;
|
||||||
int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
|
int v1 = CLAMP((int) lround(data->values[i] * pix), 1, pix);
|
||||||
int v2 = CLAMP((int) lround(data->values[i+1] * pix), 1, pix);
|
int v2 = CLAMP((int) lround(data->values[i + 1] * pix), 1, pix);
|
||||||
|
|
||||||
int colorIdx = GRAPH_1;
|
int colorIdx = GRAPH_1;
|
||||||
for (int line = 0; line < GRAPH_HEIGHT; line++) {
|
for (int line = 0; line < GRAPH_HEIGHT; line++) {
|
||||||
|
@ -317,7 +317,7 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
int line2 = CLAMP(v2 - (GraphMeterMode_pixPerRow * (GRAPH_HEIGHT - 1 - line)), 0, GraphMeterMode_pixPerRow);
|
int line2 = CLAMP(v2 - (GraphMeterMode_pixPerRow * (GRAPH_HEIGHT - 1 - line)), 0, GraphMeterMode_pixPerRow);
|
||||||
|
|
||||||
attrset(CRT_colors[colorIdx]);
|
attrset(CRT_colors[colorIdx]);
|
||||||
mvaddstr(y+line, x+k, GraphMeterMode_dots[line1 * (GraphMeterMode_pixPerRow + 1) + line2]);
|
mvaddstr(y + line, x + k, GraphMeterMode_dots[line1 * (GraphMeterMode_pixPerRow + 1) + line2]);
|
||||||
colorIdx = GRAPH_2;
|
colorIdx = GRAPH_2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,17 +327,17 @@ static void GraphMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
/* ---------- LEDMeterMode ---------- */
|
/* ---------- LEDMeterMode ---------- */
|
||||||
|
|
||||||
static const char* const LEDMeterMode_digitsAscii[] = {
|
static const char* const LEDMeterMode_digitsAscii[] = {
|
||||||
" __ "," "," __ "," __ "," "," __ "," __ "," __ "," __ "," __ ",
|
" __ ", " ", " __ ", " __ ", " ", " __ ", " __ ", " __ ", " __ ", " __ ",
|
||||||
"| |"," |"," __|"," __|","|__|","|__ ","|__ "," |","|__|","|__|",
|
"| |", " |", " __|", " __|", "|__|", "|__ ", "|__ ", " |", "|__|", "|__|",
|
||||||
"|__|"," |","|__ "," __|"," |"," __|","|__|"," |","|__|"," __|"
|
"|__|", " |", "|__ ", " __|", " |", " __|", "|__|", " |", "|__|", " __|"
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_LIBNCURSESW
|
#ifdef HAVE_LIBNCURSESW
|
||||||
|
|
||||||
static const char* const LEDMeterMode_digitsUtf8[] = {
|
static const char* const LEDMeterMode_digitsUtf8[] = {
|
||||||
"┌──┐"," ┐ ","╶──┐","╶──┐","╷ ╷","┌──╴","┌──╴","╶──┐","┌──┐","┌──┐",
|
"┌──┐", " ┐ ", "╶──┐", "╶──┐", "╷ ╷", "┌──╴", "┌──╴", "╶──┐", "┌──┐", "┌──┐",
|
||||||
"│ │"," │ ","┌──┘"," ──┤","└──┤","└──┐","├──┐"," │","├──┤","└──┤",
|
"│ │", " │ ", "┌──┘", " ──┤", "└──┤", "└──┐", "├──┐", " │", "├──┤", "└──┤",
|
||||||
"└──┘"," ╵ ","└──╴","╶──┘"," ╵","╶──┘","└──┘"," ╵","└──┘"," ──┘"
|
"└──┘", " ╵ ", "└──╴", "╶──┘", " ╵", "╶──┘", "└──┘", " ╵", "└──┘", " ──┘"
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -367,9 +367,9 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
|
|
||||||
int yText =
|
int yText =
|
||||||
#ifdef HAVE_LIBNCURSESW
|
#ifdef HAVE_LIBNCURSESW
|
||||||
CRT_utf8 ? y+1 :
|
CRT_utf8 ? y + 1 :
|
||||||
#endif
|
#endif
|
||||||
y+2;
|
y + 2;
|
||||||
attrset(CRT_colors[LED_COLOR]);
|
attrset(CRT_colors[LED_COLOR]);
|
||||||
mvaddstr(yText, x, this->caption);
|
mvaddstr(yText, x, this->caption);
|
||||||
int xx = x + strlen(this->caption);
|
int xx = x + strlen(this->caption);
|
||||||
|
@ -377,7 +377,7 @@ static void LEDMeterMode_draw(Meter* this, int x, int y, int w) {
|
||||||
for (int i = 0; i < len; i++) {
|
for (int i = 0; i < len; i++) {
|
||||||
char c = RichString_getCharVal(out, i);
|
char c = RichString_getCharVal(out, i);
|
||||||
if (c >= '0' && c <= '9') {
|
if (c >= '0' && c <= '9') {
|
||||||
LEDMeterMode_drawDigit(xx, y, c-48);
|
LEDMeterMode_drawDigit(xx, y, c - 48);
|
||||||
xx += 4;
|
xx += 4;
|
||||||
} else {
|
} else {
|
||||||
mvaddch(yText, xx, c);
|
mvaddch(yText, xx, c);
|
||||||
|
|
|
@ -73,7 +73,7 @@ OpenFilesScreen* OpenFilesScreen_new(const Process* process) {
|
||||||
this->pid = process->tgid;
|
this->pid = process->tgid;
|
||||||
else
|
else
|
||||||
this->pid = process->pid;
|
this->pid = process->pid;
|
||||||
return (OpenFilesScreen*) InfoScreen_init(&this->super, process, NULL, LINES-3, " FD TYPE MODE DEVICE SIZE NODE NAME");
|
return (OpenFilesScreen*) InfoScreen_init(&this->super, process, NULL, LINES - 3, " FD TYPE MODE DEVICE SIZE NODE NAME");
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenFilesScreen_delete(Object* this) {
|
void OpenFilesScreen_delete(Object* this) {
|
||||||
|
|
10
Panel.c
10
Panel.c
|
@ -201,7 +201,7 @@ void Panel_setSelected(Panel* this, int selected) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Panel_splice(Panel *this, Vector* from) {
|
void Panel_splice(Panel* this, Vector* from) {
|
||||||
assert (this != NULL);
|
assert (this != NULL);
|
||||||
assert (from != NULL);
|
assert (from != NULL);
|
||||||
|
|
||||||
|
@ -295,15 +295,15 @@ void Panel_draw(Panel* this, bool focus) {
|
||||||
Object_display(newObj, &new);
|
Object_display(newObj, &new);
|
||||||
int newLen = RichString_sizeVal(new);
|
int newLen = RichString_sizeVal(new);
|
||||||
this->selectedLen = newLen;
|
this->selectedLen = newLen;
|
||||||
mvhline(y+ this->oldSelected - first, x+0, ' ', this->w);
|
mvhline(y + this->oldSelected - first, x + 0, ' ', this->w);
|
||||||
if (scrollH < oldLen)
|
if (scrollH < oldLen)
|
||||||
RichString_printoffnVal(old, y+this->oldSelected - first, x,
|
RichString_printoffnVal(old, y + this->oldSelected - first, x,
|
||||||
scrollH, MINIMUM(oldLen - scrollH, this->w));
|
scrollH, MINIMUM(oldLen - scrollH, this->w));
|
||||||
attrset(selectionColor);
|
attrset(selectionColor);
|
||||||
mvhline(y+this->selected - first, x+0, ' ', this->w);
|
mvhline(y + this->selected - first, x + 0, ' ', this->w);
|
||||||
RichString_setAttr(&new, selectionColor);
|
RichString_setAttr(&new, selectionColor);
|
||||||
if (scrollH < newLen)
|
if (scrollH < newLen)
|
||||||
RichString_printoffnVal(new, y+this->selected - first, x,
|
RichString_printoffnVal(new, y + this->selected - first, x,
|
||||||
scrollH, MINIMUM(newLen - scrollH, this->w));
|
scrollH, MINIMUM(newLen - scrollH, this->w));
|
||||||
attrset(CRT_colors[RESET_COLOR]);
|
attrset(CRT_colors[RESET_COLOR]);
|
||||||
RichString_end(new);
|
RichString_end(new);
|
||||||
|
|
2
Panel.h
2
Panel.h
|
@ -111,7 +111,7 @@ void Panel_setSelected(Panel* this, int selected);
|
||||||
|
|
||||||
void Panel_draw(Panel* this, bool focus);
|
void Panel_draw(Panel* this, bool focus);
|
||||||
|
|
||||||
void Panel_splice(Panel *this, Vector* from);
|
void Panel_splice(Panel* this, Vector* from);
|
||||||
|
|
||||||
bool Panel_onKey(Panel* this, int key);
|
bool Panel_onKey(Panel* this, int key);
|
||||||
|
|
||||||
|
|
22
Process.c
22
Process.c
|
@ -74,7 +74,7 @@ void Process_humanNumber(RichString* str, unsigned long long number, bool colori
|
||||||
RichString_appendn(str, processColor, buffer, len);
|
RichString_appendn(str, processColor, buffer, len);
|
||||||
} else if (number < 100000) {
|
} else if (number < 100000) {
|
||||||
//2 digit MB, 3 digit KB
|
//2 digit MB, 3 digit KB
|
||||||
len = snprintf(buffer, 10, "%2llu", number/1000);
|
len = snprintf(buffer, 10, "%2llu", number / 1000);
|
||||||
RichString_appendn(str, processMegabytesColor, buffer, len);
|
RichString_appendn(str, processMegabytesColor, buffer, len);
|
||||||
number %= 1000;
|
number %= 1000;
|
||||||
len = snprintf(buffer, 10, "%03llu ", number);
|
len = snprintf(buffer, 10, "%03llu ", number);
|
||||||
|
@ -87,7 +87,7 @@ void Process_humanNumber(RichString* str, unsigned long long number, bool colori
|
||||||
} else if (number < 10000 * ONE_K) {
|
} else if (number < 10000 * ONE_K) {
|
||||||
//1 digit GB, 3 digit MB
|
//1 digit GB, 3 digit MB
|
||||||
number /= ONE_K;
|
number /= ONE_K;
|
||||||
len = snprintf(buffer, 10, "%1llu", number/1000);
|
len = snprintf(buffer, 10, "%1llu", number / 1000);
|
||||||
RichString_appendn(str, processGigabytesColor, buffer, len);
|
RichString_appendn(str, processGigabytesColor, buffer, len);
|
||||||
number %= 1000;
|
number %= 1000;
|
||||||
len = snprintf(buffer, 10, "%03lluM ", number);
|
len = snprintf(buffer, 10, "%03lluM ", number);
|
||||||
|
@ -95,7 +95,7 @@ void Process_humanNumber(RichString* str, unsigned long long number, bool colori
|
||||||
} else if (number < 100000 * ONE_K) {
|
} else if (number < 100000 * ONE_K) {
|
||||||
//2 digit GB, 1 digit MB
|
//2 digit GB, 1 digit MB
|
||||||
number /= 100 * ONE_K;
|
number /= 100 * ONE_K;
|
||||||
len = snprintf(buffer, 10, "%2llu", number/10);
|
len = snprintf(buffer, 10, "%2llu", number / 10);
|
||||||
RichString_appendn(str, processGigabytesColor, buffer, len);
|
RichString_appendn(str, processGigabytesColor, buffer, len);
|
||||||
number %= 10;
|
number %= 10;
|
||||||
len = snprintf(buffer, 10, ".%1lluG ", number);
|
len = snprintf(buffer, 10, ".%1lluG ", number);
|
||||||
|
@ -108,14 +108,14 @@ void Process_humanNumber(RichString* str, unsigned long long number, bool colori
|
||||||
} else if (number < 10000ULL * ONE_M) {
|
} else if (number < 10000ULL * ONE_M) {
|
||||||
//1 digit TB, 3 digit GB
|
//1 digit TB, 3 digit GB
|
||||||
number /= ONE_M;
|
number /= ONE_M;
|
||||||
len = snprintf(buffer, 10, "%1llu", number/1000);
|
len = snprintf(buffer, 10, "%1llu", number / 1000);
|
||||||
RichString_appendn(str, largeNumberColor, buffer, len);
|
RichString_appendn(str, largeNumberColor, buffer, len);
|
||||||
number %= 1000;
|
number %= 1000;
|
||||||
len = snprintf(buffer, 10, "%03lluG ", number);
|
len = snprintf(buffer, 10, "%03lluG ", number);
|
||||||
RichString_appendn(str, processGigabytesColor, buffer, len);
|
RichString_appendn(str, processGigabytesColor, buffer, len);
|
||||||
} else {
|
} else {
|
||||||
//2 digit TB and above
|
//2 digit TB and above
|
||||||
len = snprintf(buffer, 10, "%4.1lfT ", (double)number/ONE_G);
|
len = snprintf(buffer, 10, "%4.1lfT ", (double)number / ONE_G);
|
||||||
RichString_appendn(str, largeNumberColor, buffer, len);
|
RichString_appendn(str, largeNumberColor, buffer, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -142,18 +142,18 @@ void Process_colorNumber(RichString* str, unsigned long long number, bool colori
|
||||||
} else if (number >= 100LL * ONE_DECIMAL_T) {
|
} else if (number >= 100LL * ONE_DECIMAL_T) {
|
||||||
xSnprintf(buffer, 13, "%11llu ", number / ONE_DECIMAL_M);
|
xSnprintf(buffer, 13, "%11llu ", number / ONE_DECIMAL_M);
|
||||||
RichString_appendn(str, largeNumberColor, buffer, 8);
|
RichString_appendn(str, largeNumberColor, buffer, 8);
|
||||||
RichString_appendn(str, processMegabytesColor, buffer+8, 4);
|
RichString_appendn(str, processMegabytesColor, buffer + 8, 4);
|
||||||
} else if (number >= 10LL * ONE_DECIMAL_G) {
|
} else if (number >= 10LL * ONE_DECIMAL_G) {
|
||||||
xSnprintf(buffer, 13, "%11llu ", number / ONE_DECIMAL_K);
|
xSnprintf(buffer, 13, "%11llu ", number / ONE_DECIMAL_K);
|
||||||
RichString_appendn(str, largeNumberColor, buffer, 5);
|
RichString_appendn(str, largeNumberColor, buffer, 5);
|
||||||
RichString_appendn(str, processMegabytesColor, buffer+5, 3);
|
RichString_appendn(str, processMegabytesColor, buffer + 5, 3);
|
||||||
RichString_appendn(str, processColor, buffer+8, 4);
|
RichString_appendn(str, processColor, buffer + 8, 4);
|
||||||
} else {
|
} else {
|
||||||
xSnprintf(buffer, 13, "%11llu ", number);
|
xSnprintf(buffer, 13, "%11llu ", number);
|
||||||
RichString_appendn(str, largeNumberColor, buffer, 2);
|
RichString_appendn(str, largeNumberColor, buffer, 2);
|
||||||
RichString_appendn(str, processMegabytesColor, buffer+2, 3);
|
RichString_appendn(str, processMegabytesColor, buffer + 2, 3);
|
||||||
RichString_appendn(str, processColor, buffer+5, 3);
|
RichString_appendn(str, processColor, buffer + 5, 3);
|
||||||
RichString_appendn(str, processShadowColor, buffer+8, 4);
|
RichString_appendn(str, processShadowColor, buffer + 8, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ extern ProcessFieldData Process_fields[];
|
||||||
extern ProcessPidColumn Process_pidColumns[];
|
extern ProcessPidColumn Process_pidColumns[];
|
||||||
extern char Process_pidFormat[20];
|
extern char Process_pidFormat[20];
|
||||||
|
|
||||||
typedef Process*(*Process_New)(const struct Settings_*);
|
typedef Process* (* Process_New)(const struct Settings_*);
|
||||||
typedef void (*Process_WriteField)(const Process*, RichString*, ProcessField);
|
typedef void (*Process_WriteField)(const Process*, RichString*, ProcessField);
|
||||||
|
|
||||||
typedef struct ProcessClass_ {
|
typedef struct ProcessClass_ {
|
||||||
|
|
|
@ -131,9 +131,9 @@ static void ProcessList_buildTree(ProcessList* this, pid_t pid, int level, int i
|
||||||
Vector_add(this->processes2, process);
|
Vector_add(this->processes2, process);
|
||||||
else
|
else
|
||||||
Vector_insert(this->processes2, 0, process);
|
Vector_insert(this->processes2, 0, process);
|
||||||
assert(Vector_size(this->processes2) == s+1); (void)s;
|
assert(Vector_size(this->processes2) == s + 1); (void)s;
|
||||||
int nextIndent = indent | (1 << level);
|
int nextIndent = indent | (1 << level);
|
||||||
ProcessList_buildTree(this, process->pid, level+1, (i < size - 1) ? nextIndent : indent, direction, show ? process->showChildren : false);
|
ProcessList_buildTree(this, process->pid, level + 1, (i < size - 1) ? nextIndent : indent, direction, show ? process->showChildren : false);
|
||||||
if (i == size - 1)
|
if (i == size - 1)
|
||||||
process->indent = -nextIndent;
|
process->indent = -nextIndent;
|
||||||
else
|
else
|
||||||
|
@ -143,8 +143,8 @@ static void ProcessList_buildTree(ProcessList* this, pid_t pid, int level, int i
|
||||||
}
|
}
|
||||||
|
|
||||||
static long ProcessList_treeProcessCompare(const void* v1, const void* v2) {
|
static long ProcessList_treeProcessCompare(const void* v1, const void* v2) {
|
||||||
const Process *p1 = (const Process*)v1;
|
const Process* p1 = (const Process*)v1;
|
||||||
const Process *p2 = (const Process*)v2;
|
const Process* p2 = (const Process*)v2;
|
||||||
|
|
||||||
return p1->pid - p2->pid;
|
return p1->pid - p2->pid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ static void RichString_setLen(RichString* this, int len) {
|
||||||
#ifdef HAVE_LIBNCURSESW
|
#ifdef HAVE_LIBNCURSESW
|
||||||
|
|
||||||
static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) {
|
static inline void RichString_writeFrom(RichString* this, int attrs, const char* data_c, int from, int len) {
|
||||||
wchar_t data[len+1];
|
wchar_t data[len + 1];
|
||||||
len = mbstowcs(data, data_c, len);
|
len = mbstowcs(data, data_c, len);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -38,7 +38,7 @@ in the source distribution for its full text.
|
||||||
typedef struct RichString_ {
|
typedef struct RichString_ {
|
||||||
int chlen;
|
int chlen;
|
||||||
CharType* chptr;
|
CharType* chptr;
|
||||||
CharType chstr[RICHSTRING_MAXLEN+1];
|
CharType chstr[RICHSTRING_MAXLEN + 1];
|
||||||
} RichString;
|
} RichString;
|
||||||
|
|
||||||
void RichString_setAttrn(RichString* this, int attrs, int start, int finish);
|
void RichString_setAttrn(RichString* this, int attrs, int start, int finish);
|
||||||
|
|
|
@ -58,7 +58,7 @@ void ScreenManager_add(ScreenManager* this, Panel* item, int size) {
|
||||||
if (size > 0) {
|
if (size > 0) {
|
||||||
Panel_resize(item, size, height);
|
Panel_resize(item, size, height);
|
||||||
} else {
|
} else {
|
||||||
Panel_resize(item, COLS-this->x1+this->x2-lastX, height);
|
Panel_resize(item, COLS - this->x1 + this->x2 - lastX, height);
|
||||||
}
|
}
|
||||||
Panel_move(item, lastX, this->y1);
|
Panel_move(item, lastX, this->y1);
|
||||||
}
|
}
|
||||||
|
@ -85,18 +85,18 @@ void ScreenManager_resize(ScreenManager* this, int x1, int y1, int x2, int y2) {
|
||||||
int lastX = 0;
|
int lastX = 0;
|
||||||
for (int i = 0; i < panels - 1; i++) {
|
for (int i = 0; i < panels - 1; i++) {
|
||||||
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
||||||
Panel_resize(panel, panel->w, LINES-y1+y2);
|
Panel_resize(panel, panel->w, LINES - y1 + y2);
|
||||||
Panel_move(panel, lastX, y1);
|
Panel_move(panel, lastX, y1);
|
||||||
lastX = panel->x + panel->w + 1;
|
lastX = panel->x + panel->w + 1;
|
||||||
}
|
}
|
||||||
Panel* panel = (Panel*) Vector_get(this->panels, panels-1);
|
Panel* panel = (Panel*) Vector_get(this->panels, panels - 1);
|
||||||
Panel_resize(panel, COLS-x1+x2-lastX, LINES-y1+y2);
|
Panel_resize(panel, COLS - x1 + x2 - lastX, LINES - y1 + y2);
|
||||||
Panel_move(panel, lastX, y1);
|
Panel_move(panel, lastX, y1);
|
||||||
}
|
}
|
||||||
// TODO: VERTICAL
|
// TODO: VERTICAL
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTimeout, bool* redraw, bool *rescan, bool *timedOut) {
|
static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTimeout, bool* redraw, bool* rescan, bool* timedOut) {
|
||||||
ProcessList* pl = this->header->pl;
|
ProcessList* pl = this->header->pl;
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
@ -127,7 +127,7 @@ static void ScreenManager_drawPanels(ScreenManager* this, int focus) {
|
||||||
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
||||||
Panel_draw(panel, i == focus);
|
Panel_draw(panel, i == focus);
|
||||||
if (this->orientation == HORIZONTAL) {
|
if (this->orientation == HORIZONTAL) {
|
||||||
mvvline(panel->y, panel->x+panel->w, ' ', panel->h+1);
|
mvvline(panel->y, panel->x + panel->w, ' ', panel->h + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -182,11 +182,11 @@ void ScreenManager_run(ScreenManager* this, Panel** lastFocus, int* lastKey) {
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < this->panelCount; i++) {
|
for (int i = 0; i < this->panelCount; i++) {
|
||||||
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
Panel* panel = (Panel*) Vector_get(this->panels, i);
|
||||||
if (mevent.x >= panel->x && mevent.x <= panel->x+panel->w) {
|
if (mevent.x >= panel->x && mevent.x <= panel->x + panel->w) {
|
||||||
if (mevent.y == panel->y) {
|
if (mevent.y == panel->y) {
|
||||||
ch = EVENT_HEADER_CLICK(mevent.x - panel->x);
|
ch = EVENT_HEADER_CLICK(mevent.x - panel->x);
|
||||||
break;
|
break;
|
||||||
} else if (mevent.y > panel->y && mevent.y <= panel->y+panel->h) {
|
} else if (mevent.y > panel->y && mevent.y <= panel->y + panel->h) {
|
||||||
ch = KEY_MOUSE;
|
ch = KEY_MOUSE;
|
||||||
if (panel == panelFocus || this->allowFocusChange) {
|
if (panel == panelFocus || this->allowFocusChange) {
|
||||||
focus = i;
|
focus = i;
|
||||||
|
|
|
@ -217,7 +217,7 @@ static void writeFields(FILE* fd, ProcessField* fields, const char* name) {
|
||||||
const char* sep = "";
|
const char* sep = "";
|
||||||
for (int i = 0; fields[i]; i++) {
|
for (int i = 0; fields[i]; i++) {
|
||||||
// This "-1" is for compatibility with the older enum format.
|
// This "-1" is for compatibility with the older enum format.
|
||||||
fprintf(fd, "%s%d", sep, (int) fields[i]-1);
|
fprintf(fd, "%s%d", sep, (int) fields[i] - 1);
|
||||||
sep = " ";
|
sep = " ";
|
||||||
}
|
}
|
||||||
fprintf(fd, "\n");
|
fprintf(fd, "\n");
|
||||||
|
@ -255,7 +255,7 @@ bool Settings_write(Settings* this) {
|
||||||
fprintf(fd, "# The parser is also very primitive, and not human-friendly.\n");
|
fprintf(fd, "# The parser is also very primitive, and not human-friendly.\n");
|
||||||
writeFields(fd, this->fields, "fields");
|
writeFields(fd, this->fields, "fields");
|
||||||
// This "-1" is for compatibility with the older enum format.
|
// This "-1" is for compatibility with the older enum format.
|
||||||
fprintf(fd, "sort_key=%d\n", (int) this->sortKey-1);
|
fprintf(fd, "sort_key=%d\n", (int) this->sortKey - 1);
|
||||||
fprintf(fd, "sort_direction=%d\n", (int) this->direction);
|
fprintf(fd, "sort_direction=%d\n", (int) this->direction);
|
||||||
fprintf(fd, "hide_threads=%d\n", (int) this->hideThreads);
|
fprintf(fd, "hide_threads=%d\n", (int) this->hideThreads);
|
||||||
fprintf(fd, "hide_kernel_threads=%d\n", (int) this->hideKernelThreads);
|
fprintf(fd, "hide_kernel_threads=%d\n", (int) this->hideKernelThreads);
|
||||||
|
@ -311,7 +311,7 @@ Settings* Settings_new(int initialCpuCount) {
|
||||||
#ifdef HAVE_LIBHWLOC
|
#ifdef HAVE_LIBHWLOC
|
||||||
this->topologyAffinity = false;
|
this->topologyAffinity = false;
|
||||||
#endif
|
#endif
|
||||||
this->fields = xCalloc(Platform_numberOfFields+1, sizeof(ProcessField));
|
this->fields = xCalloc(Platform_numberOfFields + 1, sizeof(ProcessField));
|
||||||
// TODO: turn 'fields' into a Vector,
|
// TODO: turn 'fields' into a Vector,
|
||||||
// (and ProcessFields into proper objects).
|
// (and ProcessFields into proper objects).
|
||||||
this->flags = 0;
|
this->flags = 0;
|
||||||
|
|
|
@ -52,7 +52,7 @@ TraceScreen* TraceScreen_new(Process* process) {
|
||||||
this->tracing = true;
|
this->tracing = true;
|
||||||
FunctionBar* fuBar = FunctionBar_new(TraceScreenFunctions, TraceScreenKeys, TraceScreenEvents);
|
FunctionBar* fuBar = FunctionBar_new(TraceScreenFunctions, TraceScreenKeys, TraceScreenEvents);
|
||||||
CRT_disableDelay();
|
CRT_disableDelay();
|
||||||
return (TraceScreen*) InfoScreen_init(&this->super, process, fuBar, LINES-2, "");
|
return (TraceScreen*) InfoScreen_init(&this->super, process, fuBar, LINES - 2, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraceScreen_delete(Object* cast) {
|
void TraceScreen_delete(Object* cast) {
|
||||||
|
@ -141,8 +141,9 @@ void TraceScreen_updateTrace(InfoScreen* super) {
|
||||||
FD_SET(fd_strace, &fds);
|
FD_SET(fd_strace, &fds);
|
||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
tv.tv_sec = 0; tv.tv_usec = 500;
|
tv.tv_sec = 0;
|
||||||
int ready = select(fd_strace+1, &fds, NULL, NULL, &tv);
|
tv.tv_usec = 500;
|
||||||
|
int ready = select(fd_strace + 1, &fds, NULL, NULL, &tv);
|
||||||
size_t nread = 0;
|
size_t nread = 0;
|
||||||
if (ready > 0 && FD_ISSET(fd_strace, &fds))
|
if (ready > 0 && FD_ISSET(fd_strace, &fds))
|
||||||
nread = fread(buffer, 1, sizeof(buffer) - 1, this->strace);
|
nread = fread(buffer, 1, sizeof(buffer) - 1, this->strace);
|
||||||
|
@ -158,10 +159,10 @@ void TraceScreen_updateTrace(InfoScreen* super) {
|
||||||
} else {
|
} else {
|
||||||
InfoScreen_addLine(&this->super, line);
|
InfoScreen_addLine(&this->super, line);
|
||||||
}
|
}
|
||||||
line = buffer+i+1;
|
line = buffer + i + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (line < buffer+nread) {
|
if (line < buffer + nread) {
|
||||||
InfoScreen_addLine(&this->super, line);
|
InfoScreen_addLine(&this->super, line);
|
||||||
buffer[nread] = '\0';
|
buffer[nread] = '\0';
|
||||||
this->contLine = true;
|
this->contLine = true;
|
||||||
|
|
|
@ -24,9 +24,9 @@ static void UptimeMeter_updateValues(Meter* this, char* buffer, int len) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int seconds = totalseconds % 60;
|
int seconds = totalseconds % 60;
|
||||||
int minutes = (totalseconds/60) % 60;
|
int minutes = (totalseconds / 60) % 60;
|
||||||
int hours = (totalseconds/3600) % 24;
|
int hours = (totalseconds / 3600) % 24;
|
||||||
int days = (totalseconds/86400);
|
int days = (totalseconds / 86400);
|
||||||
this->values[0] = days;
|
this->values[0] = days;
|
||||||
if (days > this->total) {
|
if (days > this->total) {
|
||||||
this->total = days;
|
this->total = days;
|
||||||
|
|
14
Vector.c
14
Vector.c
|
@ -118,7 +118,8 @@ static int partition(Object** array, int left, int right, int pivotIndex, Object
|
||||||
static void quickSort(Object** array, int left, int right, Object_Compare compare) {
|
static void quickSort(Object** array, int left, int right, Object_Compare compare) {
|
||||||
if (left >= right)
|
if (left >= right)
|
||||||
return;
|
return;
|
||||||
int pivotIndex = (left+right) / 2;
|
|
||||||
|
int pivotIndex = (left + right) / 2;
|
||||||
int pivotNewIndex = partition(array, left, right, pivotIndex, compare);
|
int pivotNewIndex = partition(array, left, right, pivotIndex, compare);
|
||||||
quickSort(array, left, pivotNewIndex - 1, compare);
|
quickSort(array, left, pivotNewIndex - 1, compare);
|
||||||
quickSort(array, pivotNewIndex + 1, right, compare);
|
quickSort(array, pivotNewIndex + 1, right, compare);
|
||||||
|
@ -148,17 +149,18 @@ static void combSort(Object** array, int left, int right, Object_Compare compare
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void insertionSort(Object** array, int left, int right, Object_Compare compare) {
|
static void insertionSort(Object** array, int left, int right, Object_Compare compare) {
|
||||||
for (int i = left+1; i <= right; i++) {
|
for (int i = left + 1; i <= right; i++) {
|
||||||
Object* t = array[i];
|
Object* t = array[i];
|
||||||
int j = i - 1;
|
int j = i - 1;
|
||||||
while (j >= left) {
|
while (j >= left) {
|
||||||
//comparisons++;
|
//comparisons++;
|
||||||
if (compare(array[j], t) <= 0)
|
if (compare(array[j], t) <= 0)
|
||||||
break;
|
break;
|
||||||
array[j+1] = array[j];
|
|
||||||
|
array[j + 1] = array[j];
|
||||||
j--;
|
j--;
|
||||||
}
|
}
|
||||||
array[j+1] = t;
|
array[j + 1] = t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +262,7 @@ void Vector_set(Vector* this, int idx, void* data_) {
|
||||||
|
|
||||||
Vector_checkArraySize(this);
|
Vector_checkArraySize(this);
|
||||||
if (idx >= this->items) {
|
if (idx >= this->items) {
|
||||||
this->items = idx+1;
|
this->items = idx + 1;
|
||||||
} else {
|
} else {
|
||||||
if (this->owner) {
|
if (this->owner) {
|
||||||
Object* removed = this->array[idx];
|
Object* removed = this->array[idx];
|
||||||
|
@ -293,7 +295,7 @@ void Vector_add(Vector* this, void* data_) {
|
||||||
assert(Vector_isConsistent(this));
|
assert(Vector_isConsistent(this));
|
||||||
int i = this->items;
|
int i = this->items;
|
||||||
Vector_set(this, this->items, data);
|
Vector_set(this, this->items, data);
|
||||||
assert(this->items == i+1); (void)(i);
|
assert(this->items == i + 1); (void)(i);
|
||||||
assert(Vector_isConsistent(this));
|
assert(Vector_isConsistent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
Vector.h
2
Vector.h
|
@ -17,7 +17,7 @@ in the source distribution for its full text.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct Vector_ {
|
typedef struct Vector_ {
|
||||||
Object **array;
|
Object** array;
|
||||||
const ObjectClass* type;
|
const ObjectClass* type;
|
||||||
int arraySize;
|
int arraySize;
|
||||||
int growthRate;
|
int growthRate;
|
||||||
|
|
8
XUtils.c
8
XUtils.c
|
@ -59,7 +59,7 @@ char* String_cat(const char* s1, const char* s2) {
|
||||||
const size_t l2 = strlen(s2);
|
const size_t l2 = strlen(s2);
|
||||||
char* out = xMalloc(l1 + l2 + 1);
|
char* out = xMalloc(l1 + l2 + 1);
|
||||||
memcpy(out, s1, l1);
|
memcpy(out, s1, l1);
|
||||||
memcpy(out+l1, s2, l2);
|
memcpy(out + l1, s2, l2);
|
||||||
out[l1 + l2] = '\0';
|
out[l1 + l2] = '\0';
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ char* String_trim(const char* in) {
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len = strlen(in);
|
size_t len = strlen(in);
|
||||||
while (len > 0 && (in[len-1] == ' ' || in[len-1] == '\t' || in[len-1] == '\n')) {
|
while (len > 0 && (in[len - 1] == ' ' || in[len - 1] == '\t' || in[len - 1] == '\n')) {
|
||||||
len--;
|
len--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,12 +126,12 @@ char* String_getToken(const char* line, const unsigned short int numMatch) {
|
||||||
|
|
||||||
for (size_t i = 0; i < len; i++) {
|
for (size_t i = 0; i < len; i++) {
|
||||||
char lastState = inWord;
|
char lastState = inWord;
|
||||||
inWord = line[i] == ' ' ? 0:1;
|
inWord = line[i] == ' ' ? 0 : 1;
|
||||||
|
|
||||||
if (lastState == 0 && inWord == 1)
|
if (lastState == 0 && inWord == 1)
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
if (inWord == 1){
|
if (inWord == 1) {
|
||||||
if (count == numMatch && line[i] != ' ' && line[i] != '\0' && line[i] != '\n' && line[i] != (char)EOF) {
|
if (count == numMatch && line[i] != ' ' && line[i] != '\0' && line[i] != '\n' && line[i] != (char)EOF) {
|
||||||
match[foundCount] = line[i];
|
match[foundCount] = line[i];
|
||||||
foundCount++;
|
foundCount++;
|
||||||
|
|
4
XUtils.h
4
XUtils.h
|
@ -54,10 +54,10 @@ char* String_getToken(const char* line, unsigned short int numMatch);
|
||||||
char* String_readLine(FILE* fd);
|
char* String_readLine(FILE* fd);
|
||||||
|
|
||||||
ATTR_FORMAT(printf, 2, 3)
|
ATTR_FORMAT(printf, 2, 3)
|
||||||
int xAsprintf(char **strp, const char* fmt, ...);
|
int xAsprintf(char** strp, const char* fmt, ...);
|
||||||
|
|
||||||
ATTR_FORMAT(printf, 3, 4)
|
ATTR_FORMAT(printf, 3, 4)
|
||||||
int xSnprintf(char *buf, int len, const char* fmt, ...);
|
int xSnprintf(char* buf, int len, const char* fmt, ...);
|
||||||
|
|
||||||
char* xStrdup(const char* str) ATTR_NONNULL;
|
char* xStrdup(const char* str) ATTR_NONNULL;
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ bool Process_isThread(const Process* this) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *DarwinProcess_getCmdLine(struct kinfo_proc* k, int* basenameOffset) {
|
char* DarwinProcess_getCmdLine(struct kinfo_proc* k, int* basenameOffset) {
|
||||||
/* This function is from the old Mac version of htop. Originally from ps? */
|
/* This function is from the old Mac version of htop. Originally from ps? */
|
||||||
int mib[3], argmax, nargs, c = 0;
|
int mib[3], argmax, nargs, c = 0;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
@ -68,7 +68,7 @@ char *DarwinProcess_getCmdLine(struct kinfo_proc* k, int* basenameOffset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate space for the arguments. */
|
/* Allocate space for the arguments. */
|
||||||
procargs = ( char * ) xMalloc( argmax );
|
procargs = (char*)xMalloc(argmax);
|
||||||
if ( procargs == NULL ) {
|
if ( procargs == NULL ) {
|
||||||
goto ERROR_A;
|
goto ERROR_A;
|
||||||
}
|
}
|
||||||
|
@ -195,8 +195,8 @@ ERROR_A:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarwinProcess_setFromKInfoProc(Process *proc, struct kinfo_proc *ps, bool exists) {
|
void DarwinProcess_setFromKInfoProc(Process* proc, struct kinfo_proc* ps, bool exists) {
|
||||||
struct extern_proc *ep = &ps->kp_proc;
|
struct extern_proc* ep = &ps->kp_proc;
|
||||||
|
|
||||||
/* UNSET HERE :
|
/* UNSET HERE :
|
||||||
*
|
*
|
||||||
|
@ -241,7 +241,7 @@ void DarwinProcess_setFromKInfoProc(Process *proc, struct kinfo_proc *ps, bool e
|
||||||
proc->updated = true;
|
proc->updated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DarwinProcess_setFromLibprocPidinfo(DarwinProcess *proc, DarwinProcessList *dpl) {
|
void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessList* dpl) {
|
||||||
struct proc_taskinfo pti;
|
struct proc_taskinfo pti;
|
||||||
|
|
||||||
if (sizeof(pti) == proc_pidinfo(proc->super.pid, PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {
|
if (sizeof(pti) == proc_pidinfo(proc->super.pid, PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {
|
||||||
|
@ -280,7 +280,7 @@ void DarwinProcess_setFromLibprocPidinfo(DarwinProcess *proc, DarwinProcessList
|
||||||
* Based on: http://stackoverflow.com/questions/6788274/ios-mac-cpu-usage-for-thread
|
* Based on: http://stackoverflow.com/questions/6788274/ios-mac-cpu-usage-for-thread
|
||||||
* and https://github.com/max-horvath/htop-osx/blob/e86692e869e30b0bc7264b3675d2a4014866ef46/ProcessList.c
|
* and https://github.com/max-horvath/htop-osx/blob/e86692e869e30b0bc7264b3675d2a4014866ef46/ProcessList.c
|
||||||
*/
|
*/
|
||||||
void DarwinProcess_scanThreads(DarwinProcess *dp) {
|
void DarwinProcess_scanThreads(DarwinProcess* dp) {
|
||||||
Process* proc = (Process*) dp;
|
Process* proc = (Process*) dp;
|
||||||
kern_return_t ret;
|
kern_return_t ret;
|
||||||
|
|
||||||
|
|
|
@ -28,17 +28,17 @@ void Process_delete(Object* cast);
|
||||||
|
|
||||||
bool Process_isThread(const Process* this);
|
bool Process_isThread(const Process* this);
|
||||||
|
|
||||||
char *DarwinProcess_getCmdLine(struct kinfo_proc* k, int* basenameOffset);
|
char* DarwinProcess_getCmdLine(struct kinfo_proc* k, int* basenameOffset);
|
||||||
|
|
||||||
void DarwinProcess_setFromKInfoProc(Process *proc, struct kinfo_proc *ps, bool exists);
|
void DarwinProcess_setFromKInfoProc(Process* proc, struct kinfo_proc* ps, bool exists);
|
||||||
|
|
||||||
void DarwinProcess_setFromLibprocPidinfo(DarwinProcess *proc, DarwinProcessList *dpl);
|
void DarwinProcess_setFromLibprocPidinfo(DarwinProcess* proc, DarwinProcessList* dpl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Scan threads for process state information.
|
* Scan threads for process state information.
|
||||||
* Based on: http://stackoverflow.com/questions/6788274/ios-mac-cpu-usage-for-thread
|
* Based on: http://stackoverflow.com/questions/6788274/ios-mac-cpu-usage-for-thread
|
||||||
* and https://github.com/max-horvath/htop-osx/blob/e86692e869e30b0bc7264b3675d2a4014866ef46/ProcessList.c
|
* and https://github.com/max-horvath/htop-osx/blob/e86692e869e30b0bc7264b3675d2a4014866ef46/ProcessList.c
|
||||||
*/
|
*/
|
||||||
void DarwinProcess_scanThreads(DarwinProcess *dp);
|
void DarwinProcess_scanThreads(DarwinProcess* dp);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -27,7 +27,7 @@ struct kern {
|
||||||
short int version[3];
|
short int version[3];
|
||||||
};
|
};
|
||||||
|
|
||||||
void GetKernelVersion(struct kern *k) {
|
void GetKernelVersion(struct kern* k) {
|
||||||
static short int version_[3] = {0};
|
static short int version_[3] = {0};
|
||||||
if (!version_[0]) {
|
if (!version_[0]) {
|
||||||
// just in case it fails someday
|
// just in case it fails someday
|
||||||
|
@ -64,7 +64,7 @@ int CompareKernelVersion(short int major, short int minor, short int component)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessList_getHostInfo(host_basic_info_data_t *p) {
|
void ProcessList_getHostInfo(host_basic_info_data_t* p) {
|
||||||
mach_msg_type_number_t info_size = HOST_BASIC_INFO_COUNT;
|
mach_msg_type_number_t info_size = HOST_BASIC_INFO_COUNT;
|
||||||
|
|
||||||
if (0 != host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)p, &info_size)) {
|
if (0 != host_info(mach_host_self(), HOST_BASIC_INFO, (host_info_t)p, &info_size)) {
|
||||||
|
@ -72,7 +72,7 @@ void ProcessList_getHostInfo(host_basic_info_data_t *p) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t *p) {
|
void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t* p) {
|
||||||
if (NULL != p && NULL != *p) {
|
if (NULL != p && NULL != *p) {
|
||||||
if (0 != munmap(*p, vm_page_size)) {
|
if (0 != munmap(*p, vm_page_size)) {
|
||||||
CRT_fatalError("Unable to free old CPU load information\n");
|
CRT_fatalError("Unable to free old CPU load information\n");
|
||||||
|
@ -81,7 +81,7 @@ void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t *p) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p) {
|
unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t* p) {
|
||||||
mach_msg_type_number_t info_size = sizeof(processor_cpu_load_info_t);
|
mach_msg_type_number_t info_size = sizeof(processor_cpu_load_info_t);
|
||||||
unsigned cpu_count;
|
unsigned cpu_count;
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ void ProcessList_getVMStats(vm_statistics_t p) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count) {
|
struct kinfo_proc* ProcessList_getKInfoProcs(size_t* count) {
|
||||||
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
|
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0 };
|
||||||
struct kinfo_proc *processes = NULL;
|
struct kinfo_proc* processes = NULL;
|
||||||
|
|
||||||
/* Note the two calls to sysctl(). One to get length and one to get the
|
/* Note the two calls to sysctl(). One to get length and one to get the
|
||||||
* data. This -does- mean that the second call could end up with a missing
|
* data. This -does- mean that the second call could end up with a missing
|
||||||
|
|
|
@ -9,7 +9,7 @@ in the source distribution for its full text.
|
||||||
|
|
||||||
struct kern;
|
struct kern;
|
||||||
|
|
||||||
void GetKernelVersion(struct kern *k);
|
void GetKernelVersion(struct kern* k);
|
||||||
|
|
||||||
/* compare the given os version with the one installed returns:
|
/* compare the given os version with the one installed returns:
|
||||||
0 if equals the installed version
|
0 if equals the installed version
|
||||||
|
@ -37,15 +37,15 @@ typedef struct DarwinProcessList_ {
|
||||||
ZfsArcStats zfs;
|
ZfsArcStats zfs;
|
||||||
} DarwinProcessList;
|
} DarwinProcessList;
|
||||||
|
|
||||||
void ProcessList_getHostInfo(host_basic_info_data_t *p);
|
void ProcessList_getHostInfo(host_basic_info_data_t* p);
|
||||||
|
|
||||||
void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t *p);
|
void ProcessList_freeCPULoadInfo(processor_cpu_load_info_t* p);
|
||||||
|
|
||||||
unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t *p);
|
unsigned ProcessList_allocateCPULoadInfo(processor_cpu_load_info_t* p);
|
||||||
|
|
||||||
void ProcessList_getVMStats(vm_statistics_t p);
|
void ProcessList_getVMStats(vm_statistics_t p);
|
||||||
|
|
||||||
struct kinfo_proc *ProcessList_getKInfoProcs(size_t *count);
|
struct kinfo_proc* ProcessList_getKInfoProcs(size_t* count);
|
||||||
|
|
||||||
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
|
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@ ProcessPidColumn Process_pidColumns[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
static double Platform_setCPUAverageValues(Meter* mtr) {
|
static double Platform_setCPUAverageValues(Meter* mtr) {
|
||||||
const ProcessList *dpl = mtr->pl;
|
const ProcessList* dpl = mtr->pl;
|
||||||
int cpus = dpl->cpuCount;
|
int cpus = dpl->cpuCount;
|
||||||
double sumNice = 0.0;
|
double sumNice = 0.0;
|
||||||
double sumNormal = 0.0;
|
double sumNormal = 0.0;
|
||||||
|
@ -200,9 +200,9 @@ double Platform_setCPUValues(Meter* mtr, int cpu) {
|
||||||
return Platform_setCPUAverageValues(mtr);
|
return Platform_setCPUAverageValues(mtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const DarwinProcessList *dpl = (const DarwinProcessList *)mtr->pl;
|
const DarwinProcessList* dpl = (const DarwinProcessList*)mtr->pl;
|
||||||
const processor_cpu_load_info_t prev = &dpl->prev_load[cpu-1];
|
const processor_cpu_load_info_t prev = &dpl->prev_load[cpu - 1];
|
||||||
const processor_cpu_load_info_t curr = &dpl->curr_load[cpu-1];
|
const processor_cpu_load_info_t curr = &dpl->curr_load[cpu - 1];
|
||||||
double total = 0;
|
double total = 0;
|
||||||
|
|
||||||
/* Take the sums */
|
/* Take the sums */
|
||||||
|
@ -228,7 +228,7 @@ double Platform_setCPUValues(Meter* mtr, int cpu) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_setMemoryValues(Meter* mtr) {
|
void Platform_setMemoryValues(Meter* mtr) {
|
||||||
const DarwinProcessList *dpl = (const DarwinProcessList *)mtr->pl;
|
const DarwinProcessList* dpl = (const DarwinProcessList*)mtr->pl;
|
||||||
const struct vm_statistics* vm = &dpl->vm_stats;
|
const struct vm_statistics* vm = &dpl->vm_stats;
|
||||||
double page_K = (double)vm_page_size / (double)1024;
|
double page_K = (double)vm_page_size / (double)1024;
|
||||||
|
|
||||||
|
@ -283,14 +283,14 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
p += sizeof(int);
|
p += sizeof(int);
|
||||||
|
|
||||||
// skip exe
|
// skip exe
|
||||||
p = strchr(p, 0)+1;
|
p = strchr(p, 0) + 1;
|
||||||
|
|
||||||
// skip padding
|
// skip padding
|
||||||
while (!*p && p < endp)
|
while (!*p && p < endp)
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
// skip argv
|
// skip argv
|
||||||
for (; argc-- && p < endp; p = strrchr(p, 0)+1)
|
for (; argc-- && p < endp; p = strrchr(p, 0) + 1)
|
||||||
;
|
;
|
||||||
|
|
||||||
// skip padding
|
// skip padding
|
||||||
|
@ -298,10 +298,10 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
size_t size = endp - p;
|
size_t size = endp - p;
|
||||||
env = xMalloc(size+2);
|
env = xMalloc(size + 2);
|
||||||
memcpy(env, p, size);
|
memcpy(env, p, size);
|
||||||
env[size] = 0;
|
env[size] = 0;
|
||||||
env[size+1] = 0;
|
env[size + 1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -317,10 +317,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted) {
|
unsigned long int* packetsTransmitted) {
|
||||||
// TODO
|
// TODO
|
||||||
*bytesReceived = 0;
|
*bytesReceived = 0;
|
||||||
*packetsReceived = 0;
|
*packetsReceived = 0;
|
||||||
|
|
|
@ -51,9 +51,9 @@ char* Platform_getProcessEnv(pid_t pid);
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data);
|
bool Platform_getDiskIO(DiskIOData* data);
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted);
|
unsigned long int* packetsTransmitted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -92,7 +92,7 @@ void DragonFlyBSDProcess_writeField(const Process* this, RichString* str, Proces
|
||||||
// add Platform-specific fields here
|
// add Platform-specific fields here
|
||||||
case PID: xSnprintf(buffer, n, Process_pidFormat, (fp->kernel ? -1 : this->pid)); break;
|
case PID: xSnprintf(buffer, n, Process_pidFormat, (fp->kernel ? -1 : this->pid)); break;
|
||||||
case JID: xSnprintf(buffer, n, Process_pidFormat, fp->jid); break;
|
case JID: xSnprintf(buffer, n, Process_pidFormat, fp->jid); break;
|
||||||
case JAIL:{
|
case JAIL: {
|
||||||
xSnprintf(buffer, n, "%-11s ", fp->jname);
|
xSnprintf(buffer, n, "%-11s ", fp->jname);
|
||||||
if (buffer[11] != '\0') {
|
if (buffer[11] != '\0') {
|
||||||
buffer[11] = ' ';
|
buffer[11] = ' ';
|
||||||
|
|
|
@ -149,8 +149,8 @@ static inline void DragonFlyBSDProcessList_scanCPUTime(ProcessList* pl) {
|
||||||
|
|
||||||
size_t sizeof_cp_time_array;
|
size_t sizeof_cp_time_array;
|
||||||
|
|
||||||
unsigned long *cp_time_n; // old clicks state
|
unsigned long* cp_time_n; // old clicks state
|
||||||
unsigned long *cp_time_o; // current clicks state
|
unsigned long* cp_time_o; // current clicks state
|
||||||
|
|
||||||
unsigned long cp_time_d[CPUSTATES];
|
unsigned long cp_time_d[CPUSTATES];
|
||||||
double cp_time_p[CPUSTATES];
|
double cp_time_p[CPUSTATES];
|
||||||
|
@ -296,9 +296,9 @@ char* DragonFlyBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kpro
|
||||||
|
|
||||||
static inline void DragonFlyBSDProcessList_scanJails(DragonFlyBSDProcessList* dfpl) {
|
static inline void DragonFlyBSDProcessList_scanJails(DragonFlyBSDProcessList* dfpl) {
|
||||||
size_t len;
|
size_t len;
|
||||||
char *jls; /* Jail list */
|
char* jls; /* Jail list */
|
||||||
char *curpos;
|
char* curpos;
|
||||||
char *nextpos;
|
char* nextpos;
|
||||||
|
|
||||||
if (sysctlbyname("jail.list", NULL, &len, NULL, 0) == -1) {
|
if (sysctlbyname("jail.list", NULL, &len, NULL, 0) == -1) {
|
||||||
fprintf(stderr, "initial sysctlbyname / jail.list failed\n");
|
fprintf(stderr, "initial sysctlbyname / jail.list failed\n");
|
||||||
|
@ -329,7 +329,7 @@ retry:
|
||||||
curpos = jls;
|
curpos = jls;
|
||||||
while (curpos) {
|
while (curpos) {
|
||||||
int jailid;
|
int jailid;
|
||||||
char *str_hostname;
|
char* str_hostname;
|
||||||
nextpos = strchr(curpos, '\n');
|
nextpos = strchr(curpos, '\n');
|
||||||
if (nextpos)
|
if (nextpos)
|
||||||
*nextpos++ = 0;
|
*nextpos++ = 0;
|
||||||
|
@ -337,7 +337,7 @@ retry:
|
||||||
jailid = atoi(strtok(curpos, " "));
|
jailid = atoi(strtok(curpos, " "));
|
||||||
str_hostname = strtok(NULL, " ");
|
str_hostname = strtok(NULL, " ");
|
||||||
|
|
||||||
char *jname = (char *) (Hashtable_get(dfpl->jails, jailid));
|
char* jname = (char*) (Hashtable_get(dfpl->jails, jailid));
|
||||||
if (jname == NULL) {
|
if (jname == NULL) {
|
||||||
jname = xStrdup(str_hostname);
|
jname = xStrdup(str_hostname);
|
||||||
Hashtable_put(dfpl->jails, jailid, jname);
|
Hashtable_put(dfpl->jails, jailid, jname);
|
||||||
|
@ -353,7 +353,7 @@ char* DragonFlyBSDProcessList_readJailName(DragonFlyBSDProcessList* dfpl, int ja
|
||||||
char* hostname;
|
char* hostname;
|
||||||
char* jname;
|
char* jname;
|
||||||
|
|
||||||
if (jailid != 0 && dfpl->jails && (hostname = (char *)Hashtable_get(dfpl->jails, jailid))) {
|
if (jailid != 0 && dfpl->jails && (hostname = (char*)Hashtable_get(dfpl->jails, jailid))) {
|
||||||
jname = xStrdup(hostname);
|
jname = xStrdup(hostname);
|
||||||
} else {
|
} else {
|
||||||
jname = xStrdup("-");
|
jname = xStrdup("-");
|
||||||
|
|
|
@ -42,13 +42,13 @@ typedef struct DragonFlyBSDProcessList_ {
|
||||||
|
|
||||||
CPUData* cpus;
|
CPUData* cpus;
|
||||||
|
|
||||||
unsigned long *cp_time_o;
|
unsigned long* cp_time_o;
|
||||||
unsigned long *cp_time_n;
|
unsigned long* cp_time_n;
|
||||||
|
|
||||||
unsigned long *cp_times_o;
|
unsigned long* cp_times_o;
|
||||||
unsigned long *cp_times_n;
|
unsigned long* cp_times_n;
|
||||||
|
|
||||||
Hashtable *jails;
|
Hashtable* jails;
|
||||||
} DragonFlyBSDProcessList;
|
} DragonFlyBSDProcessList;
|
||||||
|
|
||||||
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
|
ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, uid_t userId);
|
||||||
|
|
|
@ -169,11 +169,11 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||||
v[CPU_METER_KERNEL] = cpuData->systemPercent;
|
v[CPU_METER_KERNEL] = cpuData->systemPercent;
|
||||||
v[CPU_METER_IRQ] = cpuData->irqPercent;
|
v[CPU_METER_IRQ] = cpuData->irqPercent;
|
||||||
this->curItems = 4;
|
this->curItems = 4;
|
||||||
percent = v[0]+v[1]+v[2]+v[3];
|
percent = v[0] + v[1] + v[2] + v[3];
|
||||||
} else {
|
} else {
|
||||||
v[2] = cpuData->systemAllPercent;
|
v[2] = cpuData->systemAllPercent;
|
||||||
this->curItems = 3;
|
this->curItems = 3;
|
||||||
percent = v[0]+v[1]+v[2];
|
percent = v[0] + v[1] + v[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
percent = CLAMP(percent, 0.0, 100.0);
|
percent = CLAMP(percent, 0.0, 100.0);
|
||||||
|
@ -212,10 +212,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted) {
|
unsigned long int* packetsTransmitted) {
|
||||||
// TODO
|
// TODO
|
||||||
*bytesReceived = 0;
|
*bytesReceived = 0;
|
||||||
*packetsReceived = 0;
|
*packetsReceived = 0;
|
||||||
|
|
|
@ -43,9 +43,9 @@ char* Platform_getProcessEnv(pid_t pid);
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data);
|
bool Platform_getDiskIO(DiskIOData* data);
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted);
|
unsigned long int* packetsTransmitted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,7 +83,7 @@ static void FreeBSDProcess_writeField(const Process* this, RichString* str, Proc
|
||||||
switch ((int) field) {
|
switch ((int) field) {
|
||||||
// add FreeBSD-specific fields here
|
// add FreeBSD-specific fields here
|
||||||
case JID: xSnprintf(buffer, n, Process_pidFormat, fp->jid); break;
|
case JID: xSnprintf(buffer, n, Process_pidFormat, fp->jid); break;
|
||||||
case JAIL:{
|
case JAIL: {
|
||||||
xSnprintf(buffer, n, "%-11s ", fp->jname);
|
xSnprintf(buffer, n, "%-11s ", fp->jname);
|
||||||
if (buffer[11] != '\0') {
|
if (buffer[11] != '\0') {
|
||||||
buffer[11] = ' ';
|
buffer[11] = ' ';
|
||||||
|
|
|
@ -175,8 +175,8 @@ static inline void FreeBSDProcessList_scanCPUTime(ProcessList* pl) {
|
||||||
|
|
||||||
size_t sizeof_cp_time_array;
|
size_t sizeof_cp_time_array;
|
||||||
|
|
||||||
unsigned long *cp_time_n; // old clicks state
|
unsigned long* cp_time_n; // old clicks state
|
||||||
unsigned long *cp_time_o; // current clicks state
|
unsigned long* cp_time_o; // current clicks state
|
||||||
|
|
||||||
unsigned long cp_time_d[CPUSTATES];
|
unsigned long cp_time_d[CPUSTATES];
|
||||||
double cp_time_p[CPUSTATES];
|
double cp_time_p[CPUSTATES];
|
||||||
|
@ -415,18 +415,18 @@ static char* FreeBSDProcessList_readJailName(const struct kinfo_proc* kproc) {
|
||||||
char* jname;
|
char* jname;
|
||||||
char jnamebuf[MAXHOSTNAMELEN];
|
char jnamebuf[MAXHOSTNAMELEN];
|
||||||
|
|
||||||
if (kproc->ki_jid != 0 ){
|
if (kproc->ki_jid != 0 ) {
|
||||||
memset(jnamebuf, 0, sizeof(jnamebuf));
|
memset(jnamebuf, 0, sizeof(jnamebuf));
|
||||||
IGNORE_WCASTQUAL_BEGIN
|
IGNORE_WCASTQUAL_BEGIN
|
||||||
*(const void **)&jiov[0].iov_base = "jid";
|
*(const void**)&jiov[0].iov_base = "jid";
|
||||||
jiov[0].iov_len = sizeof("jid");
|
jiov[0].iov_len = sizeof("jid");
|
||||||
jiov[1].iov_base = (void*) &kproc->ki_jid;
|
jiov[1].iov_base = (void*) &kproc->ki_jid;
|
||||||
jiov[1].iov_len = sizeof(kproc->ki_jid);
|
jiov[1].iov_len = sizeof(kproc->ki_jid);
|
||||||
*(const void **)&jiov[2].iov_base = "name";
|
*(const void**)&jiov[2].iov_base = "name";
|
||||||
jiov[2].iov_len = sizeof("name");
|
jiov[2].iov_len = sizeof("name");
|
||||||
jiov[3].iov_base = jnamebuf;
|
jiov[3].iov_base = jnamebuf;
|
||||||
jiov[3].iov_len = sizeof(jnamebuf);
|
jiov[3].iov_len = sizeof(jnamebuf);
|
||||||
*(const void **)&jiov[4].iov_base = "errmsg";
|
*(const void**)&jiov[4].iov_base = "errmsg";
|
||||||
jiov[4].iov_len = sizeof("errmsg");
|
jiov[4].iov_len = sizeof("errmsg");
|
||||||
jiov[5].iov_base = jail_errmsg;
|
jiov[5].iov_base = jail_errmsg;
|
||||||
jiov[5].iov_len = JAIL_ERRMSGLEN;
|
jiov[5].iov_len = JAIL_ERRMSGLEN;
|
||||||
|
@ -446,8 +446,8 @@ IGNORE_WCASTQUAL_END
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
jnamebuf[0]='-';
|
jnamebuf[0] = '-';
|
||||||
jnamebuf[1]='\0';
|
jnamebuf[1] = '\0';
|
||||||
jname = xStrdup(jnamebuf);
|
jname = xStrdup(jnamebuf);
|
||||||
}
|
}
|
||||||
return jname;
|
return jname;
|
||||||
|
|
|
@ -48,11 +48,11 @@ typedef struct FreeBSDProcessList_ {
|
||||||
|
|
||||||
Hashtable* ttys;
|
Hashtable* ttys;
|
||||||
|
|
||||||
unsigned long *cp_time_o;
|
unsigned long* cp_time_o;
|
||||||
unsigned long *cp_time_n;
|
unsigned long* cp_time_n;
|
||||||
|
|
||||||
unsigned long *cp_times_o;
|
unsigned long* cp_times_o;
|
||||||
unsigned long *cp_times_n;
|
unsigned long* cp_times_n;
|
||||||
|
|
||||||
} FreeBSDProcessList;
|
} FreeBSDProcessList;
|
||||||
|
|
||||||
|
|
|
@ -180,11 +180,11 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||||
v[CPU_METER_KERNEL] = cpuData->systemPercent;
|
v[CPU_METER_KERNEL] = cpuData->systemPercent;
|
||||||
v[CPU_METER_IRQ] = cpuData->irqPercent;
|
v[CPU_METER_IRQ] = cpuData->irqPercent;
|
||||||
this->curItems = 4;
|
this->curItems = 4;
|
||||||
percent = v[0]+v[1]+v[2]+v[3];
|
percent = v[0] + v[1] + v[2] + v[3];
|
||||||
} else {
|
} else {
|
||||||
v[2] = cpuData->systemAllPercent;
|
v[2] = cpuData->systemAllPercent;
|
||||||
this->curItems = 3;
|
this->curItems = 3;
|
||||||
percent = v[0]+v[1]+v[2];
|
percent = v[0] + v[1] + v[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
percent = CLAMP(percent, 0.0, 100.0);
|
percent = CLAMP(percent, 0.0, 100.0);
|
||||||
|
@ -234,10 +234,10 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env[capacity-1] || env[capacity-2]) {
|
if (env[capacity - 1] || env[capacity - 2]) {
|
||||||
env = xRealloc(env, capacity+2);
|
env = xRealloc(env, capacity + 2);
|
||||||
env[capacity] = 0;
|
env[capacity] = 0;
|
||||||
env[capacity+1] = 0;
|
env[capacity + 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return env;
|
return env;
|
||||||
|
@ -283,10 +283,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted) {
|
unsigned long int* packetsTransmitted) {
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
// get number of interfaces
|
// get number of interfaces
|
||||||
|
|
|
@ -46,9 +46,9 @@ char* Platform_getProcessEnv(pid_t pid);
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data);
|
bool Platform_getDiskIO(DiskIOData* data);
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted);
|
unsigned long int* packetsTransmitted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
10
htop.c
10
htop.c
|
@ -106,10 +106,10 @@ static CommandLineSettings parseArguments(int argc, char** argv) {
|
||||||
{"tree", no_argument, 0, 't'},
|
{"tree", no_argument, 0, 't'},
|
||||||
{"pid", required_argument, 0, 'p'},
|
{"pid", required_argument, 0, 'p'},
|
||||||
{"filter", required_argument, 0, 'F'},
|
{"filter", required_argument, 0, 'F'},
|
||||||
{0,0,0,0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
int opt, opti=0;
|
int opt, opti = 0;
|
||||||
/* Parse arguments */
|
/* Parse arguments */
|
||||||
while ((opt = getopt_long(argc, argv, "hVMCs:td:u::Up:F:", long_opts, &opti))) {
|
while ((opt = getopt_long(argc, argv, "hVMCs:td:u::Up:F:", long_opts, &opti))) {
|
||||||
if (opt == EOF) break;
|
if (opt == EOF) break;
|
||||||
|
@ -218,7 +218,7 @@ static void millisleep(unsigned long millisec) {
|
||||||
.tv_sec = 0,
|
.tv_sec = 0,
|
||||||
.tv_nsec = millisec * 1000000L
|
.tv_nsec = millisec * 1000000L
|
||||||
};
|
};
|
||||||
while (nanosleep(&req,&req)==-1) {
|
while (nanosleep(&req, &req) == -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -242,7 +242,7 @@ static void setCommFilter(State* state, char** commFilter) {
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
char *lc_ctype = getenv("LC_CTYPE");
|
char* lc_ctype = getenv("LC_CTYPE");
|
||||||
if (lc_ctype != NULL)
|
if (lc_ctype != NULL)
|
||||||
setlocale(LC_CTYPE, lc_ctype);
|
setlocale(LC_CTYPE, lc_ctype);
|
||||||
else if ((lc_ctype = getenv("LC_ALL")))
|
else if ((lc_ctype = getenv("LC_ALL")))
|
||||||
|
@ -318,7 +318,7 @@ int main(int argc, char** argv) {
|
||||||
ScreenManager_run(scr, NULL, NULL);
|
ScreenManager_run(scr, NULL, NULL);
|
||||||
|
|
||||||
attron(CRT_colors[RESET_COLOR]);
|
attron(CRT_colors[RESET_COLOR]);
|
||||||
mvhline(LINES-1, 0, ' ', COLS);
|
mvhline(LINES - 1, 0, ' ', COLS);
|
||||||
attroff(CRT_colors[RESET_COLOR]);
|
attroff(CRT_colors[RESET_COLOR]);
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ Linux battery readings written by Ian P. Hands (iphands@gmail.com, ihands@redhat
|
||||||
// but I think this is on the way out so I did not rewrite it.
|
// but I think this is on the way out so I did not rewrite it.
|
||||||
// The /sys implementation below does things the right way.
|
// The /sys implementation below does things the right way.
|
||||||
|
|
||||||
static unsigned long int parseBatInfo(const char *fileName, const unsigned short int lineNum, const unsigned short int wordNum) {
|
static unsigned long int parseBatInfo(const char* fileName, const unsigned short int lineNum, const unsigned short int wordNum) {
|
||||||
const char batteryPath[] = PROCDIR "/acpi/battery/";
|
const char batteryPath[] = PROCDIR "/acpi/battery/";
|
||||||
DIR* batteryDir = opendir(batteryPath);
|
DIR* batteryDir = opendir(batteryPath);
|
||||||
if (!batteryDir)
|
if (!batteryDir)
|
||||||
|
@ -81,7 +81,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
|
||||||
|
|
||||||
if (!line) break;
|
if (!line) break;
|
||||||
|
|
||||||
char *foundNumStr = String_getToken(line, wordNum);
|
char* foundNumStr = String_getToken(line, wordNum);
|
||||||
const unsigned long int foundNum = atoi(foundNumStr);
|
const unsigned long int foundNum = atoi(foundNumStr);
|
||||||
free(foundNumStr);
|
free(foundNumStr);
|
||||||
free(line);
|
free(line);
|
||||||
|
@ -98,8 +98,8 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
|
||||||
|
|
||||||
static ACPresence procAcpiCheck(void) {
|
static ACPresence procAcpiCheck(void) {
|
||||||
ACPresence isOn = AC_ERROR;
|
ACPresence isOn = AC_ERROR;
|
||||||
const char *power_supplyPath = PROCDIR "/acpi/ac_adapter";
|
const char* power_supplyPath = PROCDIR "/acpi/ac_adapter";
|
||||||
DIR *dir = opendir(power_supplyPath);
|
DIR* dir = opendir(power_supplyPath);
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
return AC_ERROR;
|
return AC_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +115,7 @@ static ACPresence procAcpiCheck(void) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char statePath[256];
|
char statePath[256];
|
||||||
xSnprintf((char *) statePath, sizeof statePath, "%s/%s/state", power_supplyPath, entryName);
|
xSnprintf(statePath, sizeof(statePath), "%s/%s/state", power_supplyPath, entryName);
|
||||||
FILE* file = fopen(statePath, "r");
|
FILE* file = fopen(statePath, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
isOn = AC_ERROR;
|
isOn = AC_ERROR;
|
||||||
|
@ -125,7 +125,7 @@ static ACPresence procAcpiCheck(void) {
|
||||||
fclose(file);
|
fclose(file);
|
||||||
if (!line) continue;
|
if (!line) continue;
|
||||||
|
|
||||||
char *isOnline = String_getToken(line, 2);
|
char* isOnline = String_getToken(line, 2);
|
||||||
free(line);
|
free(line);
|
||||||
|
|
||||||
if (String_eq(isOnline, "on-line")) {
|
if (String_eq(isOnline, "on-line")) {
|
||||||
|
@ -165,14 +165,14 @@ static void Battery_getProcData(double* level, ACPresence* isOnAC) {
|
||||||
// READ FROM /sys
|
// READ FROM /sys
|
||||||
// ----------------------------------------
|
// ----------------------------------------
|
||||||
|
|
||||||
static inline ssize_t xread(int fd, void *buf, size_t count) {
|
static inline ssize_t xread(int fd, void* buf, size_t count) {
|
||||||
// Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested.
|
// Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested.
|
||||||
size_t alreadyRead = 0;
|
size_t alreadyRead = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ssize_t res = read(fd, buf, count);
|
ssize_t res = read(fd, buf, count);
|
||||||
if (res == -1 && errno == EINTR) continue;
|
if (res == -1 && errno == EINTR) continue;
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
buf = ((char*)buf)+res;
|
buf = ((char*)buf) + res;
|
||||||
count -= res;
|
count -= res;
|
||||||
alreadyRead += res;
|
alreadyRead += res;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||||
*level = NAN;
|
*level = NAN;
|
||||||
*isOnAC = AC_ERROR;
|
*isOnAC = AC_ERROR;
|
||||||
|
|
||||||
DIR *dir = opendir(SYS_POWERSUPPLY_DIR);
|
DIR* dir = opendir(SYS_POWERSUPPLY_DIR);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -226,8 +226,8 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
buffer[buflen] = '\0';
|
buffer[buflen] = '\0';
|
||||||
char *buf = buffer;
|
char* buf = buffer;
|
||||||
char *line = NULL;
|
char* line = NULL;
|
||||||
bool full = false;
|
bool full = false;
|
||||||
bool now = false;
|
bool now = false;
|
||||||
int fullSize = 0;
|
int fullSize = 0;
|
||||||
|
|
|
@ -30,7 +30,7 @@ Panel* IOPriorityPanel_new(IOPriority currPrio) {
|
||||||
for (int c = 0; classes[c].name; c++) {
|
for (int c = 0; classes[c].name; c++) {
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
char name[50];
|
char name[50];
|
||||||
xSnprintf(name, sizeof(name)-1, "%s %d %s", classes[c].name, i, i == 0 ? "(High)" : (i == 7 ? "(Low)" : ""));
|
xSnprintf(name, sizeof(name) - 1, "%s %d %s", classes[c].name, i, i == 0 ? "(High)" : (i == 7 ? "(Low)" : ""));
|
||||||
IOPriority ioprio = IOPriority_tuple(classes[c].klass, i);
|
IOPriority ioprio = IOPriority_tuple(classes[c].klass, i);
|
||||||
Panel_add(this, (Object*) ListItem_new(name, ioprio));
|
Panel_add(this, (Object*) ListItem_new(name, ioprio));
|
||||||
if (currPrio == ioprio) Panel_setSelected(this, Panel_size(this) - 1);
|
if (currPrio == ioprio) Panel_setSelected(this, Panel_size(this) - 1);
|
||||||
|
|
|
@ -152,7 +152,7 @@ typedef struct LinuxProcess_ {
|
||||||
#endif
|
#endif
|
||||||
unsigned long ctxt_total;
|
unsigned long ctxt_total;
|
||||||
unsigned long ctxt_diff;
|
unsigned long ctxt_diff;
|
||||||
char *secattr;
|
char* secattr;
|
||||||
} LinuxProcess;
|
} LinuxProcess;
|
||||||
|
|
||||||
#define Process_isKernelThread(_process) (((const LinuxProcess*)(_process))->isKernelThread)
|
#define Process_isKernelThread(_process) (((const LinuxProcess*)(_process))->isKernelThread)
|
||||||
|
|
|
@ -51,14 +51,14 @@ in the source distribution for its full text.
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static ssize_t xread(int fd, void *buf, size_t count) {
|
static ssize_t xread(int fd, void* buf, size_t count) {
|
||||||
// Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested.
|
// Read some bytes. Retry on EINTR and when we don't get as many bytes as we requested.
|
||||||
size_t alreadyRead = 0;
|
size_t alreadyRead = 0;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ssize_t res = read(fd, buf, count);
|
ssize_t res = read(fd, buf, count);
|
||||||
if (res == -1 && errno == EINTR) continue;
|
if (res == -1 && errno == EINTR) continue;
|
||||||
if (res > 0) {
|
if (res > 0) {
|
||||||
buf = ((char*)buf)+res;
|
buf = ((char*)buf) + res;
|
||||||
count -= res;
|
count -= res;
|
||||||
alreadyRead += res;
|
alreadyRead += res;
|
||||||
}
|
}
|
||||||
|
@ -284,17 +284,17 @@ static inline unsigned long long LinuxProcess_adjustTime(unsigned long long t) {
|
||||||
return t * jiffytime * 100;
|
return t * jiffytime * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool LinuxProcessList_readStatFile(Process *process, const char* dirname, const char* name, char* command, int* commLen) {
|
static bool LinuxProcessList_readStatFile(Process* process, const char* dirname, const char* name, char* command, int* commLen) {
|
||||||
LinuxProcess* lp = (LinuxProcess*) process;
|
LinuxProcess* lp = (LinuxProcess*) process;
|
||||||
const int commLenIn = *commLen;
|
const int commLenIn = *commLen;
|
||||||
*commLen = 0;
|
*commLen = 0;
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s/stat", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s/stat", dirname, name);
|
||||||
int fd = open(filename, O_RDONLY);
|
int fd = open(filename, O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
static char buf[MAX_READ+1];
|
static char buf[MAX_READ + 1];
|
||||||
|
|
||||||
int size = xread(fd, buf, MAX_READ);
|
int size = xread(fd, buf, MAX_READ);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
@ -302,11 +302,11 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
|
||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
|
|
||||||
assert(process->pid == atoi(buf));
|
assert(process->pid == atoi(buf));
|
||||||
char *location = strchr(buf, ' ');
|
char* location = strchr(buf, ' ');
|
||||||
if (!location) return false;
|
if (!location) return false;
|
||||||
|
|
||||||
location += 2;
|
location += 2;
|
||||||
char *end = strrchr(location, ')');
|
char* end = strrchr(location, ')');
|
||||||
if (!end) return false;
|
if (!end) return false;
|
||||||
|
|
||||||
int commsize = MINIMUM(end - location, commLenIn - 1);
|
int commsize = MINIMUM(end - location, commLenIn - 1);
|
||||||
|
@ -352,14 +352,15 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
|
||||||
location += 1;
|
location += 1;
|
||||||
process->nlwp = strtol(location, &location, 10);
|
process->nlwp = strtol(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
location = strchr(location, ' ')+1;
|
location = strchr(location, ' ') + 1;
|
||||||
if (process->starttime_ctime == 0) {
|
if (process->starttime_ctime == 0) {
|
||||||
process->starttime_ctime = btime + LinuxProcess_adjustTime(strtoll(location, &location, 10)) / 100;
|
process->starttime_ctime = btime + LinuxProcess_adjustTime(strtoll(location, &location, 10)) / 100;
|
||||||
} else {
|
} else {
|
||||||
location = strchr(location, ' ')+1;
|
location = strchr(location, ' ') + 1;
|
||||||
}
|
}
|
||||||
location += 1;
|
location += 1;
|
||||||
for (int i=0; i<15; i++) location = strchr(location, ' ')+1;
|
for (int i = 0; i < 15; i++)
|
||||||
|
location = strchr(location, ' ') + 1;
|
||||||
process->exit_signal = strtol(location, &location, 10);
|
process->exit_signal = strtol(location, &location, 10);
|
||||||
location += 1;
|
location += 1;
|
||||||
assert(location != NULL);
|
assert(location != NULL);
|
||||||
|
@ -372,7 +373,7 @@ static bool LinuxProcessList_readStatFile(Process *process, const char* dirname,
|
||||||
|
|
||||||
|
|
||||||
static bool LinuxProcessList_statProcessDir(Process* process, const char* dirname, char* name) {
|
static bool LinuxProcessList_statProcessDir(Process* process, const char* dirname, char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
filename[MAX_NAME] = '\0';
|
filename[MAX_NAME] = '\0';
|
||||||
|
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s", dirname, name);
|
||||||
|
@ -387,7 +388,7 @@ static bool LinuxProcessList_statProcessDir(Process* process, const char* dirnam
|
||||||
#ifdef HAVE_TASKSTATS
|
#ifdef HAVE_TASKSTATS
|
||||||
|
|
||||||
static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirname, char* name, unsigned long long now) {
|
static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirname, char* name, unsigned long long now) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
filename[MAX_NAME] = '\0';
|
filename[MAX_NAME] = '\0';
|
||||||
|
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s/io", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s/io", dirname, name);
|
||||||
|
@ -414,8 +415,8 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||||
buffer[buflen] = '\0';
|
buffer[buflen] = '\0';
|
||||||
unsigned long long last_read = process->io_read_bytes;
|
unsigned long long last_read = process->io_read_bytes;
|
||||||
unsigned long long last_write = process->io_write_bytes;
|
unsigned long long last_write = process->io_write_bytes;
|
||||||
char *buf = buffer;
|
char* buf = buffer;
|
||||||
char *line = NULL;
|
char* line = NULL;
|
||||||
while ((line = strsep(&buf, "\n")) != NULL) {
|
while ((line = strsep(&buf, "\n")) != NULL) {
|
||||||
switch (line[0]) {
|
switch (line[0]) {
|
||||||
case 'r':
|
case 'r':
|
||||||
|
@ -424,7 +425,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||||
} else if (String_startsWith(line + 1, "ead_bytes: ")) {
|
} else if (String_startsWith(line + 1, "ead_bytes: ")) {
|
||||||
process->io_read_bytes = strtoull(line + 12, NULL, 10);
|
process->io_read_bytes = strtoull(line + 12, NULL, 10);
|
||||||
process->io_rate_read_bps =
|
process->io_rate_read_bps =
|
||||||
((double)(process->io_read_bytes - last_read))/(((double)(now - process->io_rate_read_time))/1000);
|
((double)(process->io_read_bytes - last_read)) / (((double)(now - process->io_rate_read_time)) / 1000);
|
||||||
process->io_rate_read_time = now;
|
process->io_rate_read_time = now;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -434,15 +435,15 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||||
} else if (String_startsWith(line + 1, "rite_bytes: ")) {
|
} else if (String_startsWith(line + 1, "rite_bytes: ")) {
|
||||||
process->io_write_bytes = strtoull(line + 13, NULL, 10);
|
process->io_write_bytes = strtoull(line + 13, NULL, 10);
|
||||||
process->io_rate_write_bps =
|
process->io_rate_write_bps =
|
||||||
((double)(process->io_write_bytes - last_write))/(((double)(now - process->io_rate_write_time))/1000);
|
((double)(process->io_write_bytes - last_write)) / (((double)(now - process->io_rate_write_time)) / 1000);
|
||||||
process->io_rate_write_time = now;
|
process->io_rate_write_time = now;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
if (line[4] == 'r' && String_startsWith(line+1, "yscr: ")) {
|
if (line[4] == 'r' && String_startsWith(line + 1, "yscr: ")) {
|
||||||
process->io_syscr = strtoull(line+7, NULL, 10);
|
process->io_syscr = strtoull(line + 7, NULL, 10);
|
||||||
} else if (String_startsWith(line+1, "yscw: ")) {
|
} else if (String_startsWith(line + 1, "yscw: ")) {
|
||||||
process->io_syscw = strtoull(line+7, NULL, 10);
|
process->io_syscw = strtoull(line + 7, NULL, 10);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -458,7 +459,7 @@ static void LinuxProcessList_readIoFile(LinuxProcess* process, const char* dirna
|
||||||
|
|
||||||
|
|
||||||
static bool LinuxProcessList_readStatmFile(LinuxProcess* process, const char* dirname, const char* name) {
|
static bool LinuxProcessList_readStatmFile(LinuxProcess* process, const char* dirname, const char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, sizeof(filename), "%s/%s/statm", dirname, name);
|
xSnprintf(filename, sizeof(filename), "%s/%s/statm", dirname, name);
|
||||||
FILE* statmfile = fopen(filename, "r");
|
FILE* statmfile = fopen(filename, "r");
|
||||||
if (!statmfile)
|
if (!statmfile)
|
||||||
|
@ -529,7 +530,7 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, sizeof(filename), "%s/%s/status", dirname, name);
|
xSnprintf(filename, sizeof(filename), "%s/%s/status", dirname, name);
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -618,7 +619,7 @@ static void LinuxProcessList_readOpenVZData(LinuxProcess* process, const char* d
|
||||||
#ifdef HAVE_CGROUP
|
#ifdef HAVE_CGROUP
|
||||||
|
|
||||||
static void LinuxProcessList_readCGroupFile(LinuxProcess* process, const char* dirname, const char* name) {
|
static void LinuxProcessList_readCGroupFile(LinuxProcess* process, const char* dirname, const char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s/cgroup", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s/cgroup", dirname, name);
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -634,7 +635,7 @@ static void LinuxProcessList_readCGroupFile(LinuxProcess* process, const char* d
|
||||||
int left = PROC_LINE_LENGTH;
|
int left = PROC_LINE_LENGTH;
|
||||||
while (!feof(file) && left > 0) {
|
while (!feof(file) && left > 0) {
|
||||||
char buffer[PROC_LINE_LENGTH + 1];
|
char buffer[PROC_LINE_LENGTH + 1];
|
||||||
char *ok = fgets(buffer, PROC_LINE_LENGTH, file);
|
char* ok = fgets(buffer, PROC_LINE_LENGTH, file);
|
||||||
if (!ok) break;
|
if (!ok) break;
|
||||||
char* group = strchr(buffer, ':');
|
char* group = strchr(buffer, ':');
|
||||||
if (!group) break;
|
if (!group) break;
|
||||||
|
@ -656,7 +657,7 @@ static void LinuxProcessList_readCGroupFile(LinuxProcess* process, const char* d
|
||||||
#ifdef HAVE_VSERVER
|
#ifdef HAVE_VSERVER
|
||||||
|
|
||||||
static void LinuxProcessList_readVServerData(LinuxProcess* process, const char* dirname, const char* name) {
|
static void LinuxProcessList_readVServerData(LinuxProcess* process, const char* dirname, const char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s/status", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s/status", dirname, name);
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if (!file)
|
if (!file)
|
||||||
|
@ -687,7 +688,7 @@ static void LinuxProcessList_readVServerData(LinuxProcess* process, const char*
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirname, const char* name) {
|
static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirname, const char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s/oom_score", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s/oom_score", dirname, name);
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -705,7 +706,7 @@ static void LinuxProcessList_readOomData(LinuxProcess* process, const char* dirn
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LinuxProcessList_readCtxtData(LinuxProcess* process, const char* dirname, const char* name) {
|
static void LinuxProcessList_readCtxtData(LinuxProcess* process, const char* dirname, const char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s/status", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s/status", dirname, name);
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if (!file)
|
if (!file)
|
||||||
|
@ -731,7 +732,7 @@ static void LinuxProcessList_readCtxtData(LinuxProcess* process, const char* dir
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LinuxProcessList_readSecattrData(LinuxProcess* process, const char* dirname, const char* name) {
|
static void LinuxProcessList_readSecattrData(LinuxProcess* process, const char* dirname, const char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, sizeof(filename), "%s/%s/attr/current", dirname, name);
|
xSnprintf(filename, sizeof(filename), "%s/%s/attr/current", dirname, name);
|
||||||
FILE* file = fopen(filename, "r");
|
FILE* file = fopen(filename, "r");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -740,14 +741,14 @@ static void LinuxProcessList_readSecattrData(LinuxProcess* process, const char*
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char buffer[PROC_LINE_LENGTH + 1];
|
char buffer[PROC_LINE_LENGTH + 1];
|
||||||
char *res = fgets(buffer, sizeof(buffer), file);
|
char* res = fgets(buffer, sizeof(buffer), file);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
if (!res) {
|
if (!res) {
|
||||||
free(process->secattr);
|
free(process->secattr);
|
||||||
process->secattr = NULL;
|
process->secattr = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char *newline = strchr(buffer, '\n');
|
char* newline = strchr(buffer, '\n');
|
||||||
if (newline)
|
if (newline)
|
||||||
*newline = '\0';
|
*newline = '\0';
|
||||||
if (process->secattr && String_eq(process->secattr, buffer))
|
if (process->secattr && String_eq(process->secattr, buffer))
|
||||||
|
@ -758,10 +759,10 @@ static void LinuxProcessList_readSecattrData(LinuxProcess* process, const char*
|
||||||
|
|
||||||
#ifdef HAVE_DELAYACCT
|
#ifdef HAVE_DELAYACCT
|
||||||
|
|
||||||
static int handleNetlinkMsg(struct nl_msg *nlmsg, void *linuxProcess) {
|
static int handleNetlinkMsg(struct nl_msg* nlmsg, void* linuxProcess) {
|
||||||
struct nlmsghdr *nlhdr;
|
struct nlmsghdr* nlhdr;
|
||||||
struct nlattr *nlattrs[TASKSTATS_TYPE_MAX + 1];
|
struct nlattr* nlattrs[TASKSTATS_TYPE_MAX + 1];
|
||||||
struct nlattr *nlattr;
|
struct nlattr* nlattr;
|
||||||
struct taskstats stats;
|
struct taskstats stats;
|
||||||
int rem;
|
int rem;
|
||||||
unsigned long long int timeDelta;
|
unsigned long long int timeDelta;
|
||||||
|
@ -777,24 +778,25 @@ static int handleNetlinkMsg(struct nl_msg *nlmsg, void *linuxProcess) {
|
||||||
memcpy(&stats, nla_data(nla_next(nla_data(nlattr), &rem)), sizeof(stats));
|
memcpy(&stats, nla_data(nla_next(nla_data(nlattr), &rem)), sizeof(stats));
|
||||||
assert(lp->super.pid == (pid_t)stats.ac_pid);
|
assert(lp->super.pid == (pid_t)stats.ac_pid);
|
||||||
|
|
||||||
timeDelta = (stats.ac_etime*1000 - lp->delay_read_time);
|
timeDelta = (stats.ac_etime * 1000 - lp->delay_read_time);
|
||||||
#define BOUNDS(x) isnan(x) ? 0.0 : ((x) > 100) ? 100.0 : (x)
|
#define BOUNDS(x) (isnan(x) ? 0.0 : ((x) > 100) ? 100.0 : (x))
|
||||||
#define DELTAPERC(x,y) BOUNDS((float) ((x) - (y)) / timeDelta * 100)
|
#define DELTAPERC(x,y) BOUNDS((float) ((x) - (y)) / timeDelta * 100)
|
||||||
lp->cpu_delay_percent = DELTAPERC(stats.cpu_delay_total, lp->cpu_delay_total);
|
lp->cpu_delay_percent = DELTAPERC(stats.cpu_delay_total, lp->cpu_delay_total);
|
||||||
lp->blkio_delay_percent = DELTAPERC(stats.blkio_delay_total, lp->blkio_delay_total);
|
lp->blkio_delay_percent = DELTAPERC(stats.blkio_delay_total, lp->blkio_delay_total);
|
||||||
lp->swapin_delay_percent = DELTAPERC(stats.swapin_delay_total, lp->swapin_delay_total);
|
lp->swapin_delay_percent = DELTAPERC(stats.swapin_delay_total, lp->swapin_delay_total);
|
||||||
#undef DELTAPERC
|
#undef DELTAPERC
|
||||||
#undef BOUNDS
|
#undef BOUNDS
|
||||||
|
|
||||||
lp->swapin_delay_total = stats.swapin_delay_total;
|
lp->swapin_delay_total = stats.swapin_delay_total;
|
||||||
lp->blkio_delay_total = stats.blkio_delay_total;
|
lp->blkio_delay_total = stats.blkio_delay_total;
|
||||||
lp->cpu_delay_total = stats.cpu_delay_total;
|
lp->cpu_delay_total = stats.cpu_delay_total;
|
||||||
lp->delay_read_time = stats.ac_etime*1000;
|
lp->delay_read_time = stats.ac_etime * 1000;
|
||||||
}
|
}
|
||||||
return NL_OK;
|
return NL_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProcess* process) {
|
static void LinuxProcessList_readDelayAcctData(LinuxProcessList* this, LinuxProcess* process) {
|
||||||
struct nl_msg *msg;
|
struct nl_msg* msg;
|
||||||
|
|
||||||
if (nl_socket_modify_cb(this->netlink_socket, NL_CB_VALID, NL_CB_CUSTOM, handleNetlinkMsg, process) < 0) {
|
if (nl_socket_modify_cb(this->netlink_socket, NL_CB_VALID, NL_CB_CUSTOM, handleNetlinkMsg, process) < 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -837,13 +839,13 @@ static void setCommand(Process* process, const char* command, int len) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirname, const char* name) {
|
static bool LinuxProcessList_readCmdlineFile(Process* process, const char* dirname, const char* name) {
|
||||||
char filename[MAX_NAME+1];
|
char filename[MAX_NAME + 1];
|
||||||
xSnprintf(filename, MAX_NAME, "%s/%s/cmdline", dirname, name);
|
xSnprintf(filename, MAX_NAME, "%s/%s/cmdline", dirname, name);
|
||||||
int fd = open(filename, O_RDONLY);
|
int fd = open(filename, O_RDONLY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
char command[4096+1]; // max cmdline length on Linux
|
char command[4096 + 1]; // max cmdline length on Linux
|
||||||
int amtRead = xread(fd, command, sizeof(command) - 1);
|
int amtRead = xread(fd, command, sizeof(command) - 1);
|
||||||
close(fd);
|
close(fd);
|
||||||
int tokenEnd = 0;
|
int tokenEnd = 0;
|
||||||
|
@ -927,7 +929,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||||
const Settings* settings = pl->settings;
|
const Settings* settings = pl->settings;
|
||||||
|
|
||||||
#ifdef HAVE_TASKSTATS
|
#ifdef HAVE_TASKSTATS
|
||||||
unsigned long long now = tv.tv_sec*1000LL+tv.tv_usec/1000LL;
|
unsigned long long now = tv.tv_sec * 1000LL + tv.tv_usec / 1000LL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dir = opendir(dirname);
|
dir = opendir(dirname);
|
||||||
|
@ -964,7 +966,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||||
|
|
||||||
LinuxProcess* lp = (LinuxProcess*) proc;
|
LinuxProcess* lp = (LinuxProcess*) proc;
|
||||||
|
|
||||||
char subdirname[MAX_NAME+1];
|
char subdirname[MAX_NAME + 1];
|
||||||
xSnprintf(subdirname, MAX_NAME, "%s/%s/task", dirname, name);
|
xSnprintf(subdirname, MAX_NAME, "%s/%s/task", dirname, name);
|
||||||
LinuxProcessList_recurseProcTree(this, subdirname, proc, period, tv);
|
LinuxProcessList_recurseProcTree(this, subdirname, proc, period, tv);
|
||||||
|
|
||||||
|
@ -976,11 +978,11 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||||
if (! LinuxProcessList_readStatmFile(lp, dirname, name))
|
if (! LinuxProcessList_readStatmFile(lp, dirname, name))
|
||||||
goto errorReadingProcess;
|
goto errorReadingProcess;
|
||||||
|
|
||||||
if ((settings->flags & PROCESS_FLAG_LINUX_SMAPS) && !Process_isKernelThread(proc)){
|
if ((settings->flags & PROCESS_FLAG_LINUX_SMAPS) && !Process_isKernelThread(proc)) {
|
||||||
if (!parent){
|
if (!parent) {
|
||||||
// Read smaps file of each process only every second pass to improve performance
|
// Read smaps file of each process only every second pass to improve performance
|
||||||
static int smaps_flag = 0;
|
static int smaps_flag = 0;
|
||||||
if ((pid & 1) == smaps_flag){
|
if ((pid & 1) == smaps_flag) {
|
||||||
LinuxProcessList_readSmapsFile(lp, dirname, name, this->haveSmapsRollup);
|
LinuxProcessList_readSmapsFile(lp, dirname, name, this->haveSmapsRollup);
|
||||||
}
|
}
|
||||||
if (pid == 1) {
|
if (pid == 1) {
|
||||||
|
@ -993,7 +995,7 @@ static bool LinuxProcessList_recurseProcTree(LinuxProcessList* this, const char*
|
||||||
|
|
||||||
proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
|
proc->show = ! ((hideKernelThreads && Process_isKernelThread(proc)) || (hideUserlandThreads && Process_isUserlandThread(proc)));
|
||||||
|
|
||||||
char command[MAX_NAME+1];
|
char command[MAX_NAME + 1];
|
||||||
unsigned long long int lasttimes = (lp->utime + lp->stime);
|
unsigned long long int lasttimes = (lp->utime + lp->stime);
|
||||||
int commLen = sizeof(command);
|
int commLen = sizeof(command);
|
||||||
unsigned int tty_nr = proc->tty_nr;
|
unsigned int tty_nr = proc->tty_nr;
|
||||||
|
|
|
@ -64,7 +64,7 @@ typedef struct LinuxProcessList_ {
|
||||||
bool haveSmapsRollup;
|
bool haveSmapsRollup;
|
||||||
|
|
||||||
#ifdef HAVE_DELAYACCT
|
#ifdef HAVE_DELAYACCT
|
||||||
struct nl_sock *netlink_socket;
|
struct nl_sock* netlink_socket;
|
||||||
int netlink_family;
|
int netlink_family;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -169,8 +169,11 @@ int Platform_getUptime() {
|
||||||
|
|
||||||
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
||||||
int activeProcs, totalProcs, lastProc;
|
int activeProcs, totalProcs, lastProc;
|
||||||
*one = 0; *five = 0; *fifteen = 0;
|
*one = 0;
|
||||||
FILE *fd = fopen(PROCDIR "/loadavg", "r");
|
*five = 0;
|
||||||
|
*fifteen = 0;
|
||||||
|
|
||||||
|
FILE* fd = fopen(PROCDIR "/loadavg", "r");
|
||||||
if (fd) {
|
if (fd) {
|
||||||
int total = fscanf(fd, "%32lf %32lf %32lf %32d/%32d %32d", one, five, fifteen,
|
int total = fscanf(fd, "%32lf %32lf %32lf %32d/%32d %32d", one, five, fifteen,
|
||||||
&activeProcs, &totalProcs, &lastProc);
|
&activeProcs, &totalProcs, &lastProc);
|
||||||
|
@ -207,15 +210,15 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||||
v[CPU_METER_IOWAIT] = cpuData->ioWaitPeriod / total * 100.0;
|
v[CPU_METER_IOWAIT] = cpuData->ioWaitPeriod / total * 100.0;
|
||||||
this->curItems = 8;
|
this->curItems = 8;
|
||||||
if (this->pl->settings->accountGuestInCPUMeter) {
|
if (this->pl->settings->accountGuestInCPUMeter) {
|
||||||
percent = v[0]+v[1]+v[2]+v[3]+v[4]+v[5]+v[6];
|
percent = v[0] + v[1] + v[2] + v[3] + v[4] + v[5] + v[6];
|
||||||
} else {
|
} else {
|
||||||
percent = v[0]+v[1]+v[2]+v[3]+v[4];
|
percent = v[0] + v[1] + v[2] + v[3] + v[4];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
v[2] = cpuData->systemAllPeriod / total * 100.0;
|
v[2] = cpuData->systemAllPeriod / total * 100.0;
|
||||||
v[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0;
|
v[3] = (cpuData->stealPeriod + cpuData->guestPeriod) / total * 100.0;
|
||||||
this->curItems = 4;
|
this->curItems = 4;
|
||||||
percent = v[0]+v[1]+v[2]+v[3];
|
percent = v[0] + v[1] + v[2] + v[3];
|
||||||
}
|
}
|
||||||
percent = CLAMP(percent, 0.0, 100.0);
|
percent = CLAMP(percent, 0.0, 100.0);
|
||||||
if (isnan(percent)) percent = 0.0;
|
if (isnan(percent)) percent = 0.0;
|
||||||
|
@ -275,7 +278,7 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
char *env = NULL;
|
char* env = NULL;
|
||||||
|
|
||||||
size_t capacity = 0;
|
size_t capacity = 0;
|
||||||
size_t size = 0;
|
size_t size = 0;
|
||||||
|
@ -299,16 +302,16 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
env = xRealloc(env, size + 2);
|
env = xRealloc(env, size + 2);
|
||||||
|
|
||||||
env[size] = '\0';
|
env[size] = '\0';
|
||||||
env[size+1] = '\0';
|
env[size + 1] = '\0';
|
||||||
|
|
||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_getPressureStall(const char *file, bool some, double* ten, double* sixty, double* threehundred) {
|
void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred) {
|
||||||
*ten = *sixty = *threehundred = 0;
|
*ten = *sixty = *threehundred = 0;
|
||||||
char procname[128+1];
|
char procname[128 + 1];
|
||||||
xSnprintf(procname, 128, PROCDIR "/pressure/%s", file);
|
xSnprintf(procname, 128, PROCDIR "/pressure/%s", file);
|
||||||
FILE *fd = fopen(procname, "r");
|
FILE* fd = fopen(procname, "r");
|
||||||
if (!fd) {
|
if (!fd) {
|
||||||
*ten = *sixty = *threehundred = NAN;
|
*ten = *sixty = *threehundred = NAN;
|
||||||
return;
|
return;
|
||||||
|
@ -323,7 +326,7 @@ void Platform_getPressureStall(const char *file, bool some, double* ten, double*
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data) {
|
bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
FILE *fd = fopen(PROCDIR "/diskstats", "r");
|
FILE* fd = fopen(PROCDIR "/diskstats", "r");
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -367,11 +370,11 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted) {
|
unsigned long int* packetsTransmitted) {
|
||||||
FILE *fd = fopen(PROCDIR "/net/dev", "r");
|
FILE* fd = fopen(PROCDIR "/net/dev", "r");
|
||||||
if (!fd)
|
if (!fd)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
|
@ -47,13 +47,13 @@ void Platform_setZfsArcValues(Meter* this);
|
||||||
void Platform_setZfsCompressedArcValues(Meter* this);
|
void Platform_setZfsCompressedArcValues(Meter* this);
|
||||||
char* Platform_getProcessEnv(pid_t pid);
|
char* Platform_getProcessEnv(pid_t pid);
|
||||||
|
|
||||||
void Platform_getPressureStall(const char *file, bool some, double* ten, double* sixty, double* threehundred);
|
void Platform_getPressureStall(const char* file, bool some, double* ten, double* sixty, double* threehundred);
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data);
|
bool Platform_getDiskIO(DiskIOData* data);
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted);
|
unsigned long int* packetsTransmitted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -53,7 +53,7 @@ void Battery_getData(double* level, ACPresence* isOnAC) {
|
||||||
mib[4] = 3;
|
mib[4] = 3;
|
||||||
if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
|
if (sysctl(mib, 5, &s, &slen, NULL, 0) != -1) {
|
||||||
double charge = s.value;
|
double charge = s.value;
|
||||||
*level = 100*(charge / last_full_capacity);
|
*level = 100 * (charge / last_full_capacity);
|
||||||
if (charge >= last_full_capacity) {
|
if (charge >= last_full_capacity) {
|
||||||
*level = 100;
|
*level = 100;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i <= pl->cpuCount; i++) {
|
for (i = 0; i <= pl->cpuCount; i++) {
|
||||||
CPUData *d = opl->cpus + i;
|
CPUData* d = opl->cpus + i;
|
||||||
d->totalTime = 1;
|
d->totalTime = 1;
|
||||||
d->totalPeriod = 1;
|
d->totalPeriod = 1;
|
||||||
}
|
}
|
||||||
|
@ -134,7 +134,7 @@ static inline void OpenBSDProcessList_scanMemoryInfo(ProcessList* pl) {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd) {
|
char* OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd) {
|
||||||
char *s, **arg;
|
char *s, **arg;
|
||||||
size_t len = 0, n;
|
size_t len = 0, n;
|
||||||
int i;
|
int i;
|
||||||
|
@ -163,7 +163,7 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
|
||||||
n = strlcat(s, arg[i], len);
|
n = strlcat(s, arg[i], len);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
/* TODO: rename all basenameEnd to basenameLen, make size_t */
|
/* TODO: rename all basenameEnd to basenameLen, make size_t */
|
||||||
*basenameEnd = MINIMUM(n, len-1);
|
*basenameEnd = MINIMUM(n, len - 1);
|
||||||
}
|
}
|
||||||
/* the trailing space should get truncated anyway */
|
/* the trailing space should get truncated anyway */
|
||||||
strlcat(s, " ", len);
|
strlcat(s, " ", len);
|
||||||
|
@ -175,9 +175,9 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
|
||||||
/*
|
/*
|
||||||
* Taken from OpenBSD's ps(1).
|
* Taken from OpenBSD's ps(1).
|
||||||
*/
|
*/
|
||||||
static double getpcpu(const struct kinfo_proc *kp) {
|
static double getpcpu(const struct kinfo_proc* kp) {
|
||||||
if (fscale == 0)
|
if (fscale == 0)
|
||||||
return (0.0);
|
return 0.0;
|
||||||
|
|
||||||
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
|
#define fxtofl(fixpt) ((double)(fixpt) / fscale)
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ static inline void OpenBSDProcessList_scanProcs(OpenBSDProcessList* this) {
|
||||||
proc->m_size = kproc->p_vm_dsize;
|
proc->m_size = kproc->p_vm_dsize;
|
||||||
proc->m_resident = kproc->p_vm_rssize;
|
proc->m_resident = kproc->p_vm_rssize;
|
||||||
proc->percent_mem = (proc->m_resident * CRT_pageSizeKB) / (double)(this->super.totalMem) * 100.0;
|
proc->percent_mem = (proc->m_resident * CRT_pageSizeKB) / (double)(this->super.totalMem) * 100.0;
|
||||||
proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount*100.0);
|
proc->percent_cpu = CLAMP(getpcpu(kproc), 0.0, this->super.cpuCount * 100.0);
|
||||||
//proc->nlwp = kproc->p_numthreads;
|
//proc->nlwp = kproc->p_numthreads;
|
||||||
//proc->time = kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 10);
|
//proc->time = kproc->p_rtime_sec + ((kproc->p_rtime_usec + 500000) / 10);
|
||||||
proc->nice = kproc->p_nice - 20;
|
proc->nice = kproc->p_nice - 20;
|
||||||
|
|
|
@ -43,7 +43,7 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
|
||||||
|
|
||||||
void ProcessList_delete(ProcessList* this);
|
void ProcessList_delete(ProcessList* this);
|
||||||
|
|
||||||
char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
|
char* OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, int* basenameEnd);
|
||||||
|
|
||||||
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
|
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
|
||||||
|
|
||||||
|
|
|
@ -162,7 +162,7 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||||
const CPUData* cpuData = &(pl->cpus[cpu]);
|
const CPUData* cpuData = &(pl->cpus[cpu]);
|
||||||
double total = cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod;
|
double total = cpuData->totalPeriod == 0 ? 1 : cpuData->totalPeriod;
|
||||||
double totalPercent;
|
double totalPercent;
|
||||||
double *v = this->values;
|
double* v = this->values;
|
||||||
|
|
||||||
v[CPU_METER_NICE] = cpuData->nicePeriod / total * 100.0;
|
v[CPU_METER_NICE] = cpuData->nicePeriod / total * 100.0;
|
||||||
v[CPU_METER_NORMAL] = cpuData->userPeriod / total * 100.0;
|
v[CPU_METER_NORMAL] = cpuData->userPeriod / total * 100.0;
|
||||||
|
@ -175,11 +175,11 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||||
v[CPU_METER_IOWAIT] = 0.0;
|
v[CPU_METER_IOWAIT] = 0.0;
|
||||||
v[CPU_METER_FREQUENCY] = NAN;
|
v[CPU_METER_FREQUENCY] = NAN;
|
||||||
this->curItems = 8;
|
this->curItems = 8;
|
||||||
totalPercent = v[0]+v[1]+v[2]+v[3];
|
totalPercent = v[0] + v[1] + v[2] + v[3];
|
||||||
} else {
|
} else {
|
||||||
v[2] = cpuData->sysAllPeriod / total * 100.0;
|
v[2] = cpuData->sysAllPeriod / total * 100.0;
|
||||||
v[3] = 0.0; // No steal nor guest on OpenBSD
|
v[3] = 0.0; // No steal nor guest on OpenBSD
|
||||||
totalPercent = v[0]+v[1]+v[2];
|
totalPercent = v[0] + v[1] + v[2];
|
||||||
this->curItems = 4;
|
this->curItems = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ void Platform_setMemoryValues(Meter* this) {
|
||||||
*/
|
*/
|
||||||
void Platform_setSwapValues(Meter* this) {
|
void Platform_setSwapValues(Meter* this) {
|
||||||
const ProcessList* pl = this->pl;
|
const ProcessList* pl = this->pl;
|
||||||
struct swapent *swdev;
|
struct swapent* swdev;
|
||||||
unsigned long long int total, used;
|
unsigned long long int total, used;
|
||||||
int nswap, rnswap, i;
|
int nswap, rnswap, i;
|
||||||
nswap = swapctl(SWAP_NSWAP, 0, 0);
|
nswap = swapctl(SWAP_NSWAP, 0, 0);
|
||||||
|
@ -243,11 +243,11 @@ void Platform_setSwapValues(Meter* this) {
|
||||||
|
|
||||||
char* Platform_getProcessEnv(pid_t pid) {
|
char* Platform_getProcessEnv(pid_t pid) {
|
||||||
char errbuf[_POSIX2_LINE_MAX];
|
char errbuf[_POSIX2_LINE_MAX];
|
||||||
char *env;
|
char* env;
|
||||||
char **ptr;
|
char** ptr;
|
||||||
int count;
|
int count;
|
||||||
kvm_t *kt;
|
kvm_t* kt;
|
||||||
struct kinfo_proc *kproc;
|
struct kinfo_proc* kproc;
|
||||||
size_t capacity = 4096, size = 0;
|
size_t capacity = 4096, size = 0;
|
||||||
|
|
||||||
if ((kt = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
|
if ((kt = kvm_openfiles(NULL, NULL, NULL, KVM_NO_FILES, errbuf)) == NULL)
|
||||||
|
@ -265,7 +265,7 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
}
|
}
|
||||||
|
|
||||||
env = xMalloc(capacity);
|
env = xMalloc(capacity);
|
||||||
for (char **p = ptr; *p; p++) {
|
for (char** p = ptr; *p; p++) {
|
||||||
size_t len = strlen(*p) + 1;
|
size_t len = strlen(*p) + 1;
|
||||||
|
|
||||||
if (size + len > capacity) {
|
if (size + len > capacity) {
|
||||||
|
@ -294,10 +294,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted) {
|
unsigned long int* packetsTransmitted) {
|
||||||
// TODO
|
// TODO
|
||||||
*bytesReceived = 0;
|
*bytesReceived = 0;
|
||||||
*packetsReceived = 0;
|
*packetsReceived = 0;
|
||||||
|
|
|
@ -44,9 +44,9 @@ char* Platform_getProcessEnv(pid_t pid);
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data);
|
bool Platform_getDiskIO(DiskIOData* data);
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted);
|
unsigned long int* packetsTransmitted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -130,7 +130,7 @@ extern char Process_pidFormat[20];
|
||||||
int Platform_getUptime() {
|
int Platform_getUptime() {
|
||||||
int boot_time = 0;
|
int boot_time = 0;
|
||||||
int curr_time = time(NULL);
|
int curr_time = time(NULL);
|
||||||
struct utmpx * ent;
|
struct utmpx* ent;
|
||||||
|
|
||||||
while (( ent = getutxent() )) {
|
while (( ent = getutxent() )) {
|
||||||
if ( !strcmp("system boot", ent->ut_line )) {
|
if ( !strcmp("system boot", ent->ut_line )) {
|
||||||
|
@ -140,7 +140,7 @@ int Platform_getUptime() {
|
||||||
|
|
||||||
endutxent();
|
endutxent();
|
||||||
|
|
||||||
return (curr_time-boot_time);
|
return (curr_time - boot_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
||||||
|
@ -151,9 +151,9 @@ void Platform_getLoadAverage(double* one, double* five, double* fifteen) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Platform_getMaxPid() {
|
int Platform_getMaxPid() {
|
||||||
kstat_ctl_t *kc = NULL;
|
kstat_ctl_t* kc = NULL;
|
||||||
kstat_t *kshandle = NULL;
|
kstat_t* kshandle = NULL;
|
||||||
kvar_t *ksvar = NULL;
|
kvar_t* ksvar = NULL;
|
||||||
int vproc = 32778; // Reasonable Solaris default
|
int vproc = 32778; // Reasonable Solaris default
|
||||||
kc = kstat_open();
|
kc = kstat_open();
|
||||||
if (kc != NULL) { kshandle = kstat_lookup(kc,"unix",0,"var"); }
|
if (kc != NULL) { kshandle = kstat_lookup(kc,"unix",0,"var"); }
|
||||||
|
@ -187,11 +187,11 @@ double Platform_setCPUValues(Meter* this, int cpu) {
|
||||||
v[CPU_METER_KERNEL] = cpuData->systemPercent;
|
v[CPU_METER_KERNEL] = cpuData->systemPercent;
|
||||||
v[CPU_METER_IRQ] = cpuData->irqPercent;
|
v[CPU_METER_IRQ] = cpuData->irqPercent;
|
||||||
this->curItems = 4;
|
this->curItems = 4;
|
||||||
percent = v[0]+v[1]+v[2]+v[3];
|
percent = v[0] + v[1] + v[2] + v[3];
|
||||||
} else {
|
} else {
|
||||||
v[2] = cpuData->systemAllPercent;
|
v[2] = cpuData->systemAllPercent;
|
||||||
this->curItems = 3;
|
this->curItems = 3;
|
||||||
percent = v[0]+v[1]+v[2];
|
percent = v[0] + v[1] + v[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
percent = CLAMP(percent, 0.0, 100.0);
|
percent = CLAMP(percent, 0.0, 100.0);
|
||||||
|
@ -228,8 +228,8 @@ void Platform_setZfsCompressedArcValues(Meter* this) {
|
||||||
ZfsCompressedArcMeter_readStats(this, &(spl->zfs));
|
ZfsCompressedArcMeter_readStats(this, &(spl->zfs));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int Platform_buildenv(void *accum, struct ps_prochandle *Phandle, uintptr_t addr, const char *str) {
|
static int Platform_buildenv(void* accum, struct ps_prochandle* Phandle, uintptr_t addr, const char* str) {
|
||||||
envAccum *accump = accum;
|
envAccum* accump = accum;
|
||||||
(void) Phandle;
|
(void) Phandle;
|
||||||
(void) addr;
|
(void) addr;
|
||||||
size_t thissz = strlen(str);
|
size_t thissz = strlen(str);
|
||||||
|
@ -247,16 +247,16 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
envAccum envBuilder;
|
envAccum envBuilder;
|
||||||
pid_t realpid = pid / 1024;
|
pid_t realpid = pid / 1024;
|
||||||
int graberr;
|
int graberr;
|
||||||
struct ps_prochandle *Phandle;
|
struct ps_prochandle* Phandle;
|
||||||
|
|
||||||
if ((Phandle = Pgrab(realpid,PGRAB_RDONLY,&graberr)) == NULL)
|
if ((Phandle = Pgrab(realpid, PGRAB_RDONLY, &graberr)) == NULL)
|
||||||
return "Unable to read process environment.";
|
return "Unable to read process environment.";
|
||||||
|
|
||||||
envBuilder.capacity = 4096;
|
envBuilder.capacity = 4096;
|
||||||
envBuilder.size = 0;
|
envBuilder.size = 0;
|
||||||
envBuilder.env = xMalloc(envBuilder.capacity);
|
envBuilder.env = xMalloc(envBuilder.capacity);
|
||||||
|
|
||||||
(void) Penv_iter(Phandle,Platform_buildenv,&envBuilder);
|
(void) Penv_iter(Phandle, Platform_buildenv, &envBuilder);
|
||||||
|
|
||||||
Prelease(Phandle, 0);
|
Prelease(Phandle, 0);
|
||||||
|
|
||||||
|
@ -270,10 +270,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted) {
|
unsigned long int* packetsTransmitted) {
|
||||||
// TODO
|
// TODO
|
||||||
*bytesReceived = 0;
|
*bytesReceived = 0;
|
||||||
*packetsReceived = 0;
|
*packetsReceived = 0;
|
||||||
|
|
|
@ -27,7 +27,7 @@ typedef struct envAccum_ {
|
||||||
size_t capacity;
|
size_t capacity;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t bytes;
|
size_t bytes;
|
||||||
char *env;
|
char* env;
|
||||||
} envAccum;
|
} envAccum;
|
||||||
|
|
||||||
extern double plat_loadavg[3];
|
extern double plat_loadavg[3];
|
||||||
|
@ -66,9 +66,9 @@ char* Platform_getProcessEnv(pid_t pid);
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data);
|
bool Platform_getDiskIO(DiskIOData* data);
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted);
|
unsigned long int* packetsTransmitted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -64,12 +64,12 @@ ProcessList* ProcessList_new(UsersTable* usersTable, Hashtable* pidMatchList, ui
|
||||||
static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
|
static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
|
||||||
const SolarisProcessList* spl = (SolarisProcessList*) pl;
|
const SolarisProcessList* spl = (SolarisProcessList*) pl;
|
||||||
int cpus = pl->cpuCount;
|
int cpus = pl->cpuCount;
|
||||||
kstat_t *cpuinfo = NULL;
|
kstat_t* cpuinfo = NULL;
|
||||||
int kchain = 0;
|
int kchain = 0;
|
||||||
kstat_named_t *idletime = NULL;
|
kstat_named_t* idletime = NULL;
|
||||||
kstat_named_t *intrtime = NULL;
|
kstat_named_t* intrtime = NULL;
|
||||||
kstat_named_t *krnltime = NULL;
|
kstat_named_t* krnltime = NULL;
|
||||||
kstat_named_t *usertime = NULL;
|
kstat_named_t* usertime = NULL;
|
||||||
double idlebuf = 0;
|
double idlebuf = 0;
|
||||||
double intrbuf = 0;
|
double intrbuf = 0;
|
||||||
double krnlbuf = 0;
|
double krnlbuf = 0;
|
||||||
|
@ -94,16 +94,16 @@ static inline void SolarisProcessList_scanCPUTime(ProcessList* pl) {
|
||||||
kchain = kstat_read(spl->kd, cpuinfo, NULL);
|
kchain = kstat_read(spl->kd, cpuinfo, NULL);
|
||||||
}
|
}
|
||||||
if (kchain != -1 ) {
|
if (kchain != -1 ) {
|
||||||
idletime = kstat_data_lookup(cpuinfo,"cpu_nsec_idle");
|
idletime = kstat_data_lookup(cpuinfo, "cpu_nsec_idle");
|
||||||
intrtime = kstat_data_lookup(cpuinfo,"cpu_nsec_intr");
|
intrtime = kstat_data_lookup(cpuinfo, "cpu_nsec_intr");
|
||||||
krnltime = kstat_data_lookup(cpuinfo,"cpu_nsec_kernel");
|
krnltime = kstat_data_lookup(cpuinfo, "cpu_nsec_kernel");
|
||||||
usertime = kstat_data_lookup(cpuinfo,"cpu_nsec_user");
|
usertime = kstat_data_lookup(cpuinfo, "cpu_nsec_user");
|
||||||
}
|
}
|
||||||
|
|
||||||
assert( (idletime != NULL) && (intrtime != NULL)
|
assert( (idletime != NULL) && (intrtime != NULL)
|
||||||
&& (krnltime != NULL) && (usertime != NULL) );
|
&& (krnltime != NULL) && (usertime != NULL) );
|
||||||
|
|
||||||
CPUData* cpuData = &(spl->cpus[i+arrskip]);
|
CPUData* cpuData = &(spl->cpus[i + arrskip]);
|
||||||
totaltime = (idletime->value.ui64 - cpuData->lidle)
|
totaltime = (idletime->value.ui64 - cpuData->lidle)
|
||||||
+ (intrtime->value.ui64 - cpuData->lintr)
|
+ (intrtime->value.ui64 - cpuData->lintr)
|
||||||
+ (krnltime->value.ui64 - cpuData->lkrnl)
|
+ (krnltime->value.ui64 - cpuData->lkrnl)
|
||||||
|
@ -158,9 +158,11 @@ static inline void SolarisProcessList_scanMemoryInfo(ProcessList* pl) {
|
||||||
// Part 1 - physical memory
|
// Part 1 - physical memory
|
||||||
if (spl->kd != NULL && meminfo == NULL) {
|
if (spl->kd != NULL && meminfo == NULL) {
|
||||||
// Look up the kstat chain just one, it never changes
|
// Look up the kstat chain just one, it never changes
|
||||||
meminfo = kstat_lookup(spl->kd,"unix",0,"system_pages");
|
meminfo = kstat_lookup(spl->kd, "unix", 0, "system_pages");
|
||||||
|
}
|
||||||
|
if (meminfo != NULL) {
|
||||||
|
ksrphyserr = kstat_read(spl->kd, meminfo, NULL);
|
||||||
}
|
}
|
||||||
if (meminfo != NULL) { ksrphyserr = kstat_read(spl->kd,meminfo,NULL); }
|
|
||||||
if (ksrphyserr != -1) {
|
if (ksrphyserr != -1) {
|
||||||
totalmem_pgs = kstat_data_lookup(meminfo, "physmem");
|
totalmem_pgs = kstat_data_lookup(meminfo, "physmem");
|
||||||
freemem_pgs = kstat_data_lookup(meminfo, "freemem");
|
freemem_pgs = kstat_data_lookup(meminfo, "freemem");
|
||||||
|
@ -276,13 +278,13 @@ void ProcessList_delete(ProcessList* pl) {
|
||||||
* system for more info.
|
* system for more info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *listptr) {
|
int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, void* listptr) {
|
||||||
bool preExisting;
|
bool preExisting;
|
||||||
pid_t getpid;
|
pid_t getpid;
|
||||||
|
|
||||||
// Setup process list
|
// Setup process list
|
||||||
ProcessList *pl = (ProcessList*) listptr;
|
ProcessList* pl = (ProcessList*) listptr;
|
||||||
SolarisProcessList *spl = (SolarisProcessList*) listptr;
|
SolarisProcessList* spl = (SolarisProcessList*) listptr;
|
||||||
|
|
||||||
id_t lwpid_real = _lwpsinfo->pr_lwpid;
|
id_t lwpid_real = _lwpsinfo->pr_lwpid;
|
||||||
if (lwpid_real > 1023) return 0;
|
if (lwpid_real > 1023) return 0;
|
||||||
|
@ -293,8 +295,8 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
|
||||||
} else {
|
} else {
|
||||||
getpid = lwpid;
|
getpid = lwpid;
|
||||||
}
|
}
|
||||||
Process *proc = ProcessList_getProcess(pl, getpid, &preExisting, SolarisProcess_new);
|
Process* proc = ProcessList_getProcess(pl, getpid, &preExisting, SolarisProcess_new);
|
||||||
SolarisProcess *sproc = (SolarisProcess*) proc;
|
SolarisProcess* sproc = (SolarisProcess*) proc;
|
||||||
|
|
||||||
// Common code pass 1
|
// Common code pass 1
|
||||||
proc->show = false;
|
proc->show = false;
|
||||||
|
@ -309,22 +311,22 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
|
||||||
// NOTE: This 'percentage' is a 16-bit BINARY FRACTIONS where 1.0 = 0x8000
|
// NOTE: This 'percentage' is a 16-bit BINARY FRACTIONS where 1.0 = 0x8000
|
||||||
// Source: https://docs.oracle.com/cd/E19253-01/816-5174/proc-4/index.html
|
// Source: https://docs.oracle.com/cd/E19253-01/816-5174/proc-4/index.html
|
||||||
// (accessed on 18 November 2017)
|
// (accessed on 18 November 2017)
|
||||||
proc->percent_mem = ((uint16_t)_psinfo->pr_pctmem/(double)32768)*(double)100.0;
|
proc->percent_mem = ((uint16_t)_psinfo->pr_pctmem / (double)32768) * (double)100.0;
|
||||||
proc->st_uid = _psinfo->pr_euid;
|
proc->st_uid = _psinfo->pr_euid;
|
||||||
proc->pgrp = _psinfo->pr_pgid;
|
proc->pgrp = _psinfo->pr_pgid;
|
||||||
proc->nlwp = _psinfo->pr_nlwp;
|
proc->nlwp = _psinfo->pr_nlwp;
|
||||||
proc->tty_nr = _psinfo->pr_ttydev;
|
proc->tty_nr = _psinfo->pr_ttydev;
|
||||||
proc->m_resident = _psinfo->pr_rssize/CRT_pageSizeKB;
|
proc->m_resident = _psinfo->pr_rssize / CRT_pageSizeKB;
|
||||||
proc->m_size = _psinfo->pr_size/CRT_pageSizeKB;
|
proc->m_size = _psinfo->pr_size / CRT_pageSizeKB;
|
||||||
|
|
||||||
if (!preExisting) {
|
if (!preExisting) {
|
||||||
sproc->realpid = _psinfo->pr_pid;
|
sproc->realpid = _psinfo->pr_pid;
|
||||||
sproc->lwpid = lwpid_real;
|
sproc->lwpid = lwpid_real;
|
||||||
sproc->zoneid = _psinfo->pr_zoneid;
|
sproc->zoneid = _psinfo->pr_zoneid;
|
||||||
sproc->zname = SolarisProcessList_readZoneName(spl->kd,sproc);
|
sproc->zname = SolarisProcessList_readZoneName(spl->kd, sproc);
|
||||||
proc->user = UsersTable_getRef(pl->usersTable, proc->st_uid);
|
proc->user = UsersTable_getRef(pl->usersTable, proc->st_uid);
|
||||||
proc->comm = xStrdup(_psinfo->pr_fname);
|
proc->comm = xStrdup(_psinfo->pr_fname);
|
||||||
proc->commLen = strnlen(_psinfo->pr_fname,PRFNSZ);
|
proc->commLen = strnlen(_psinfo->pr_fname, PRFNSZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
// End common code pass 1
|
// End common code pass 1
|
||||||
|
@ -334,7 +336,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
|
||||||
proc->tgid = (_psinfo->pr_ppid * 1024);
|
proc->tgid = (_psinfo->pr_ppid * 1024);
|
||||||
sproc->realppid = _psinfo->pr_ppid;
|
sproc->realppid = _psinfo->pr_ppid;
|
||||||
// See note above (in common section) about this BINARY FRACTION
|
// See note above (in common section) about this BINARY FRACTION
|
||||||
proc->percent_cpu = ((uint16_t)_psinfo->pr_pctcpu/(double)32768)*(double)100.0;
|
proc->percent_cpu = ((uint16_t)_psinfo->pr_pctcpu / (double)32768) * (double)100.0;
|
||||||
proc->time = _psinfo->pr_time.tv_sec;
|
proc->time = _psinfo->pr_time.tv_sec;
|
||||||
if (!preExisting) { // Tasks done only for NEW processes
|
if (!preExisting) { // Tasks done only for NEW processes
|
||||||
sproc->is_lwp = false;
|
sproc->is_lwp = false;
|
||||||
|
@ -344,7 +346,7 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
|
||||||
// Update proc and thread counts based on settings
|
// Update proc and thread counts based on settings
|
||||||
if (sproc->kernel && !pl->settings->hideKernelThreads) {
|
if (sproc->kernel && !pl->settings->hideKernelThreads) {
|
||||||
pl->kernelThreads += proc->nlwp;
|
pl->kernelThreads += proc->nlwp;
|
||||||
pl->totalTasks += proc->nlwp+1;
|
pl->totalTasks += proc->nlwp + 1;
|
||||||
if (proc->state == 'O') pl->runningTasks++;
|
if (proc->state == 'O') pl->runningTasks++;
|
||||||
} else if (!sproc->kernel) {
|
} else if (!sproc->kernel) {
|
||||||
if (proc->state == 'O') pl->runningTasks++;
|
if (proc->state == 'O') pl->runningTasks++;
|
||||||
|
@ -352,12 +354,12 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
|
||||||
pl->totalTasks++;
|
pl->totalTasks++;
|
||||||
} else {
|
} else {
|
||||||
pl->userlandThreads += proc->nlwp;
|
pl->userlandThreads += proc->nlwp;
|
||||||
pl->totalTasks += proc->nlwp+1;
|
pl->totalTasks += proc->nlwp + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
proc->show = !(pl->settings->hideKernelThreads && sproc->kernel);
|
proc->show = !(pl->settings->hideKernelThreads && sproc->kernel);
|
||||||
} else { // We are not in the master LWP, so jump to the LWP handling code
|
} else { // We are not in the master LWP, so jump to the LWP handling code
|
||||||
proc->percent_cpu = ((uint16_t)_lwpsinfo->pr_pctcpu/(double)32768)*(double)100.0;
|
proc->percent_cpu = ((uint16_t)_lwpsinfo->pr_pctcpu / (double)32768) * (double)100.0;
|
||||||
proc->time = _lwpsinfo->pr_time.tv_sec;
|
proc->time = _lwpsinfo->pr_time.tv_sec;
|
||||||
if (!preExisting) { // Tasks done only for NEW LWPs
|
if (!preExisting) { // Tasks done only for NEW LWPs
|
||||||
sproc->is_lwp = true;
|
sproc->is_lwp = true;
|
||||||
|
@ -369,8 +371,12 @@ int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top-level process only gets this for the representative LWP
|
// Top-level process only gets this for the representative LWP
|
||||||
if (sproc->kernel && !pl->settings->hideKernelThreads) proc->show = true;
|
if (sproc->kernel && !pl->settings->hideKernelThreads) {
|
||||||
if (!sproc->kernel && !pl->settings->hideUserlandThreads) proc->show = true;
|
proc->show = true;
|
||||||
|
}
|
||||||
|
if (!sproc->kernel && !pl->settings->hideUserlandThreads) {
|
||||||
|
proc->show = true;
|
||||||
|
}
|
||||||
} // Top-level LWP or subordinate LWP
|
} // Top-level LWP or subordinate LWP
|
||||||
|
|
||||||
// Common code pass 2
|
// Common code pass 2
|
||||||
|
|
|
@ -58,7 +58,7 @@ void ProcessList_delete(ProcessList* pl);
|
||||||
* system for more info.
|
* system for more info.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int SolarisProcessList_walkproc(psinfo_t *_psinfo, lwpsinfo_t *_lwpsinfo, void *listptr);
|
int SolarisProcessList_walkproc(psinfo_t* _psinfo, lwpsinfo_t* _lwpsinfo, void* listptr);
|
||||||
|
|
||||||
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
|
void ProcessList_goThroughEntries(ProcessList* super, bool pauseProcessUpdate);
|
||||||
|
|
||||||
|
|
|
@ -146,10 +146,10 @@ bool Platform_getDiskIO(DiskIOData* data) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted) {
|
unsigned long int* packetsTransmitted) {
|
||||||
*bytesReceived = 0;
|
*bytesReceived = 0;
|
||||||
*packetsReceived = 0;
|
*packetsReceived = 0;
|
||||||
*bytesTransmitted = 0;
|
*bytesTransmitted = 0;
|
||||||
|
|
|
@ -50,9 +50,9 @@ char* Platform_getProcessEnv(pid_t pid);
|
||||||
|
|
||||||
bool Platform_getDiskIO(DiskIOData* data);
|
bool Platform_getDiskIO(DiskIOData* data);
|
||||||
|
|
||||||
bool Platform_getNetworkIO(unsigned long int *bytesReceived,
|
bool Platform_getNetworkIO(unsigned long int* bytesReceived,
|
||||||
unsigned long int *packetsReceived,
|
unsigned long int* packetsReceived,
|
||||||
unsigned long int *bytesTransmitted,
|
unsigned long int* bytesTransmitted,
|
||||||
unsigned long int *packetsTransmitted);
|
unsigned long int* packetsTransmitted);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -33,7 +33,7 @@ void ZfsCompressedArcMeter_readStats(Meter* this, const ZfsArcStats* stats) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ZfsCompressedArcMeter_printRatioString(const Meter* this, char* buffer, int size) {
|
static void ZfsCompressedArcMeter_printRatioString(const Meter* this, char* buffer, int size) {
|
||||||
xSnprintf(buffer, size, "%.2f:1", this->total/this->values[0]);
|
xSnprintf(buffer, size, "%.2f:1", this->total / this->values[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ZfsCompressedArcMeter_updateValues(Meter* this, char* buffer, int size) {
|
static void ZfsCompressedArcMeter_updateValues(Meter* this, char* buffer, int size) {
|
||||||
|
|
|
@ -27,7 +27,7 @@ static int MIB_kstat_zfs_misc_arcstats_uncompressed_size[5];
|
||||||
#include "zfs/ZfsArcStats.h"
|
#include "zfs/ZfsArcStats.h"
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
void openzfs_sysctl_init(ZfsArcStats *stats) {
|
void openzfs_sysctl_init(ZfsArcStats* stats) {
|
||||||
size_t len;
|
size_t len;
|
||||||
unsigned long long int arcSize;
|
unsigned long long int arcSize;
|
||||||
|
|
||||||
|
@ -56,45 +56,45 @@ void openzfs_sysctl_init(ZfsArcStats *stats) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void openzfs_sysctl_updateArcStats(ZfsArcStats *stats) {
|
void openzfs_sysctl_updateArcStats(ZfsArcStats* stats) {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
if (stats->enabled) {
|
if (stats->enabled) {
|
||||||
len = sizeof(stats->size);
|
len = sizeof(stats->size);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_size, 5, &(stats->size), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_size, 5, &(stats->size), &len, NULL, 0);
|
||||||
stats->size /= 1024;
|
stats->size /= 1024;
|
||||||
|
|
||||||
len = sizeof(stats->max);
|
len = sizeof(stats->max);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_c_max, 5, &(stats->max), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_c_max, 5, &(stats->max), &len, NULL, 0);
|
||||||
stats->max /= 1024;
|
stats->max /= 1024;
|
||||||
|
|
||||||
len = sizeof(stats->MFU);
|
len = sizeof(stats->MFU);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_mfu_size, 5, &(stats->MFU), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_mfu_size, 5, &(stats->MFU), &len, NULL, 0);
|
||||||
stats->MFU /= 1024;
|
stats->MFU /= 1024;
|
||||||
|
|
||||||
len = sizeof(stats->MRU);
|
len = sizeof(stats->MRU);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_mru_size, 5, &(stats->MRU), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_mru_size, 5, &(stats->MRU), &len, NULL, 0);
|
||||||
stats->MRU /= 1024;
|
stats->MRU /= 1024;
|
||||||
|
|
||||||
len = sizeof(stats->anon);
|
len = sizeof(stats->anon);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_anon_size, 5, &(stats->anon), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_anon_size, 5, &(stats->anon), &len, NULL, 0);
|
||||||
stats->anon /= 1024;
|
stats->anon /= 1024;
|
||||||
|
|
||||||
len = sizeof(stats->header);
|
len = sizeof(stats->header);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_hdr_size, 5, &(stats->header), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_hdr_size, 5, &(stats->header), &len, NULL, 0);
|
||||||
stats->header /= 1024;
|
stats->header /= 1024;
|
||||||
|
|
||||||
len = sizeof(stats->other);
|
len = sizeof(stats->other);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_other_size, 5, &(stats->other), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_other_size, 5, &(stats->other), &len, NULL, 0);
|
||||||
stats->other /= 1024;
|
stats->other /= 1024;
|
||||||
|
|
||||||
if (stats->isCompressed) {
|
if (stats->isCompressed) {
|
||||||
len = sizeof(stats->compressed);
|
len = sizeof(stats->compressed);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_compressed_size, 5, &(stats->compressed), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_compressed_size, 5, &(stats->compressed), &len, NULL, 0);
|
||||||
stats->compressed /= 1024;
|
stats->compressed /= 1024;
|
||||||
|
|
||||||
len = sizeof(stats->uncompressed);
|
len = sizeof(stats->uncompressed);
|
||||||
sysctl(MIB_kstat_zfs_misc_arcstats_uncompressed_size, 5, &(stats->uncompressed), &len , NULL, 0);
|
sysctl(MIB_kstat_zfs_misc_arcstats_uncompressed_size, 5, &(stats->uncompressed), &len, NULL, 0);
|
||||||
stats->uncompressed /= 1024;
|
stats->uncompressed /= 1024;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,8 @@ in the source distribution for its full text.
|
||||||
|
|
||||||
#include "zfs/ZfsArcStats.h"
|
#include "zfs/ZfsArcStats.h"
|
||||||
|
|
||||||
void openzfs_sysctl_init(ZfsArcStats *stats);
|
void openzfs_sysctl_init(ZfsArcStats* stats);
|
||||||
|
|
||||||
void openzfs_sysctl_updateArcStats(ZfsArcStats *stats);
|
void openzfs_sysctl_updateArcStats(ZfsArcStats* stats);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue