fix: fix only Ready/Running processes reported in mtkfetch
This commit is contained in:
@@ -46,6 +46,11 @@ static void pad(int n) {
|
||||
|
||||
static constexpr int NUM_LINES = 19;
|
||||
static constexpr int INFO_COL = 26;
|
||||
static constexpr int PROC_SCAN_MAX = 256;
|
||||
|
||||
static bool process_state_alive(uint8_t state) {
|
||||
return state == 1 || state == 2 || state == 3; /* Ready / Running / Blocked */
|
||||
}
|
||||
|
||||
static const char* art[] = {
|
||||
/* 0 */ "",
|
||||
@@ -117,11 +122,11 @@ extern "C" void _start() {
|
||||
}
|
||||
}
|
||||
|
||||
Montauk::ProcInfo procs[64];
|
||||
int nproc = montauk::proclist(procs, 64);
|
||||
static Montauk::ProcInfo procs[PROC_SCAN_MAX];
|
||||
int nproc = montauk::proclist(procs, PROC_SCAN_MAX);
|
||||
int active = 0;
|
||||
for (int i = 0; i < nproc; i++) {
|
||||
if (procs[i].state == 1 || procs[i].state == 2) active++;
|
||||
if (process_state_alive(procs[i].state)) active++;
|
||||
}
|
||||
|
||||
Montauk::NetCfg net;
|
||||
|
||||
Reference in New Issue
Block a user