Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

42
LINES

< > BotCompany Repo | #3000167 // Answer for stefanreich

New Tinybrain snippet

does not parse.
```???synchronized static String answer(String s) {
STAMatches 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();
???        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") + ".";
???    }
???  
STAreturn null;
???}
```

download  show line numbers   

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: #3000167
Snippet name: Answer for stefanreich
Eternal ID of this version: #3000167/1
Text MD5: 2db837a6a955f0909b7c81a750808fba
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 19:29:02
Source code size: 1576 bytes / 42 lines
Pitched / IR pitched: No / No
Views / Downloads: 445 / 122
Referenced in: [show references]