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).

!7

static ShowBigText sbt;

p-noconsole {
  sbt = showBigText("MHz", f make, 1000);
}

sS[] make() {
  int cores = 0;
  double totalMHz = 0, min = 1e10, max = 0;
  
  for (S line : toLines(loadTextFile("/proc/cpuinfo")))
    if (contains(line, "MHz")) {
      S s = trim(partAfterColon(line));
      ++cores;
      double mhz = parseDouble(s);
      totalMHz += mhz;
      min = min(min, mhz);
      max = max(max, mhz);
    }
    
  if (cores == 0) ret new S[] {"No CPU", "No CPU"};
  S s = iround(max) + " MHz";
  if (sbt != null) sbt.setToolTip(n(cores, "core"));
  ret new S[] {s, s};
}

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: 621 / 1179
Version history: 4 change(s)
Referenced in: