Warning: session_start(): open(/var/lib/php/sessions/sess_kprsoh1d0qe77ljd5stp9due8d, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
sclass Process {
S processID, name, commandLine;
long residentSize;
double cpuUsage; // percent per core
static S _fieldOrder = "processID name commandLine residentSize cpuUsage";
}
module ProcessList > DynObjectTable {
bool showTiming;
S switchableFields() { ret 'showTiming; }
start {
dontPersist();
itemToMap = func(Process p) -> Map { humanizeKeys(
applyFunctionToMapValue('cpuUsage, f iround_spacePercentSign,
applyFunctionToMapValue('residentSize, f str_toM,
objectToMap_honorFieldOrder(p)))) };
actualUpdate(); // to make sort keys work
doEvery(5.0, r actualUpdate);
}
afterVisualize {
addRowSorter_desc(table, 4); // CPU
rowSorter_setComparators(table, 3, alphaNumComparator(), 2, alphaNumComparator(), 4, alphaNumComparator());
swing { ((DefaultRowSorter) table.getRowSorter()).sort(); }
tablePopupMenuItem(table(), "Kill!", rThread { killProcess(selected().processID) });
}
void actualUpdate enter {
L list = timedIf(showTiming, func -> L { oshi_listProcesses_withoutOpenFiles() });
setData(map(list, func(OSProcess p) -> Process {
nu(Process,
processID := str(p.getProcessID()),
name := p.getName(),
commandLine := p.getCommandLine(),
residentSize := p.getResidentSetSize(),
cpuUsage := oshi_calcProcessCPUUsage_v2(p))
}));
}
}