Skip to content

Commit 79abc57

Browse files
committed
Display a FAILED message in the FunctionBar on host scan failure
Implements review feedback from BenBE, suggesting to show when a PCP metrics collection daemon (pmcd) is restarted/stopped and we cannot retrieve latest values as a result. This uses the method employed to display PAUSED updates, which is given preference in the case where both are true.
1 parent ad92b38 commit 79abc57

14 files changed

Lines changed: 43 additions & 0 deletions

File tree

Action.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ typedef struct State_ {
3737
struct MainPanel_* mainPanel;
3838
Header* header;
3939
bool pauseUpdate;
40+
bool validUpdate;
4041
bool hideSelection;
4142
bool hideMeters;
4243
} State;

CommandLine.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ int CommandLine_run(int argc, char** argv) {
378378
.mainPanel = panel,
379379
.header = header,
380380
.pauseUpdate = false,
381+
.validUpdate = true,
381382
.hideSelection = false,
382383
.hideMeters = false,
383384
};

MainPanel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,8 @@ static void MainPanel_drawFunctionBar(Panel* super, bool hideFunctionBar) {
194194
IncSet_drawBar(this->inc, CRT_colors[FUNCTION_BAR]);
195195
if (this->state->pauseUpdate) {
196196
FunctionBar_append("PAUSED", CRT_colors[PAUSED]);
197+
} else if (!this->state->validUpdate) {
198+
FunctionBar_append("FAILED", CRT_colors[FAILED_READ]);
197199
}
198200
}
199201

ScreenManager.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ static void checkRecalculation(ScreenManager* this, double* oldTime, int* sortTi
147147
Machine_scan(host);
148148
if (!this->state->pauseUpdate)
149149
Machine_scanTables(host);
150+
this->state->validUpdate = Platform_getValidState();
150151

151152
// always update header, especially to avoid gaps in graph meters
152153
Header_updateData(this->header);

darwin/Platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ static inline void Platform_getRelease(char** string) {
8888
*string = Generic_uname();
8989
}
9090

91+
static inline bool Platform_getValidState(void) {
92+
return true;
93+
}
94+
9195
#define PLATFORM_LONG_OPTIONS
9296

9397
static inline void Platform_longOptionsUsage(ATTR_UNUSED const char* name) { }

dragonflybsd/Platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ static inline void Platform_getRelease(char** string) {
7777
*string = Generic_uname();
7878
}
7979

80+
static inline bool Platform_getValidState(void) {
81+
return true;
82+
}
83+
8084
#define PLATFORM_LONG_OPTIONS
8185

8286
static inline void Platform_longOptionsUsage(ATTR_UNUSED const char* name) { }

freebsd/Platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ static inline void Platform_getRelease(char** string) {
7777
*string = Generic_uname();
7878
}
7979

80+
static inline bool Platform_getValidState(void) {
81+
return true;
82+
}
83+
8084
#define PLATFORM_LONG_OPTIONS
8185

8286
static inline void Platform_longOptionsUsage(ATTR_UNUSED const char* name) { }

linux/Platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ static inline void Platform_getRelease(char** string) {
9898
*string = Generic_uname();
9999
}
100100

101+
static inline bool Platform_getValidState(void) {
102+
return true;
103+
}
104+
101105
#ifdef HAVE_LIBCAP
102106
#define PLATFORM_LONG_OPTIONS \
103107
{"drop-capabilities", optional_argument, 0, 160},

netbsd/Platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ static inline void Platform_getRelease(char** string) {
8383
*string = Generic_uname();
8484
}
8585

86+
static inline bool Platform_getValidState(void) {
87+
return true;
88+
}
89+
8690
static inline void Platform_longOptionsUsage(ATTR_UNUSED const char* name) { }
8791

8892
static inline CommandLineStatus Platform_getLongOption(ATTR_UNUSED int opt, ATTR_UNUSED int argc, ATTR_UNUSED char** argv) {

openbsd/Platform.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ static inline void Platform_getRelease(char** string) {
7575
*string = Generic_uname();
7676
}
7777

78+
static inline bool Platform_getValidState(void) {
79+
return true;
80+
}
81+
7882
#define PLATFORM_LONG_OPTIONS
7983

8084
static inline void Platform_longOptionsUsage(ATTR_UNUSED const char* name) { }

0 commit comments

Comments
 (0)