Warning: session_start(): open(/var/lib/php/sessions/sess_86qrqk2tfsnk2fjq8j3q0fj29s, 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 ThreadMemoryAllocationRates extends DynModule {
transient SimpleLiveValue lv = stringLiveValue();
transient Map lastValues;
transient long lastTime;
JComponent visualize() {
ret jLiveValueTypeWriterTextArea(lv);
}
start {
doEveryAndNow(5.0, r doIt);
}
void doIt {
temp enter();
if (!threadAllocatedMemoryEnabled())
ret with lv.set("Thread memory allocation not monitored");
com.sun.management.ThreadMXBean bean = advancedThreadMXBean();
L threads = allThreads_fast();
long[] values = bean.getThreadAllocatedBytes(threadIDs_array(threads));
new Map map;
new Map names;
for i over values: {
Thread t = threads.get(i);
long id = t.getId();
map.put(id, values[i]);
names.put(id, t.getName());
}
long diffTime = sysNow()-lastTime;
lastTime = sysNow();
if (lastValues != null) {
new L lines;
for (Long id, value : map) {
long diff = value - or(lastValues.get(id), 0L);
diff = diff*1000/diffTime;
if (diff != 0)
lines.add(padLeft(str(toK(diff)), 9) + "K/s: " + names.get(id));
}
lv.set(lines(reverseSorted(lines)));
}
lastValues = map;
}
}