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

27
LINES

< > BotCompany Repo | #1010371 // Display current CPU speed (MHz) as big text [Linux]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (7932L/54K).

1  
!7
2  
3  
static ShowBigText sbt;
4  
5  
p-noconsole {
6  
  sbt = showBigText("MHz", f make, 1000);
7  
}
8  
9  
sS[] make() {
10  
  int cores = 0;
11  
  double totalMHz = 0, min = 1e10, max = 0;
12  
  
13  
  for (S line : toLines(loadTextFile("/proc/cpuinfo")))
14  
    if (contains(line, "MHz")) {
15  
      S s = trim(partAfterColon(line));
16  
      ++cores;
17  
      double mhz = parseDouble(s);
18  
      totalMHz += mhz;
19  
      min = min(min, mhz);
20  
      max = max(max, mhz);
21  
    }
22  
    
23  
  if (cores == 0) ret new S[] {"No CPU", "No CPU"};
24  
  S s = iround(max) + " MHz";
25  
  if (sbt != null) sbt.setToolTip(n(cores, "core"));
26  
  ret new S[] {s, s};
27  
}

Author comment

Began life as a copy of #1010369

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1010371
Snippet name: Display current CPU speed (MHz) as big text [Linux]
Eternal ID of this version: #1010371/5
Text MD5: 3652471e0f9e6e535a109729e3506354
Transpilation MD5: b11b4a439f4c1fe874514d9105baa576
Author: stefan
Category: javax / os
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-23 17:06:20
Source code size: 617 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 502 / 922
Version history: 4 change(s)
Referenced in: [show references]