parses. ```??? synchronized static String answer(String s) { STA Matches m = new Matches(); ??? ??? if (match3("cpu usage", s)) STA return formatDouble(totalPercentage, 2) + "% in Eleu process"; ??? ??? if (match3("most active thread", s)) { STA Thread t = getMostActiveThread(); STA return t == null ? "Sorry, no info." : format3("Thread name: *, cpu: *", t.getName(), formatDouble(totalPercentage, 2) + "%"); ??? } ??? ??? if (match3("cpu: get measurement interval", s)) STA return interval + " ms"; ??? ??? if (match3("cpu: are you measuring", s)) STA return "Yes."; ??? ??? if (match3("cpu: get last measurement time", s)) STA return "" + lastMeasured; ??? ??? if (match("cpu: list all threads", s, m)) { STA List<String> l = new ArrayList<String>(); ??? for (Map.Entry<Thread, Info> e : infoMap.entrySet()) { STA Thread t = e.getKey(); STA Info info = e.getValue(); STA l.add(formatDouble(info.percentage, 1) + "% " + format("*", t.getName())); ??? } STA return slackSnippet(fromLines(l)); ??? } ??? ??? if (match("system load", s, m)) STA return "System load: " + formatDouble(ManagementFactory.getOperatingSystemMXBean().getSystemLoadAverage(), 1); ??? ??? if (match("cpu: processors", s, m)) { STA OperatingSystemMXBean bean = ManagementFactory.getOperatingSystemMXBean(); STA return "I have " + n(bean.getAvailableProcessors(), bean.getArch() + " processor") + "."; ??? } ??? STA return null; ??? } ```
Snippet is not live.
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #3000170 |
Snippet name: | Answer for stefanreich |
Eternal ID of this version: | #3000170/1 |
Text MD5: | 14b03eec63b5c956452dd86cd97b40cb |
Author: | someone |
Category: | |
Type: | New Tinybrain snippet |
Gummipassword: | eleutheria-for-user |
Uploaded from IP: | 69.10.46.185 |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-01-23 20:34:32 |
Source code size: | 1608 bytes / 42 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 509 / 126 |
Referenced in: | [show references] |