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

27
LINES

< > TinyBrain | #1010371 - Display current MHz as big text [Linux]

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

Uses 1937K of libraries. Click here for Pure Java version (4918L/33K).

!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   

Travelled to 2 computer(s): cfunsshuasjs, tvejysmllsmz

No comments. add comment

Snippet ID: #1010371
Snippet name: Display current MHz as big text [Linux]
Eternal ID of this version: #1010371/4
Text MD5: 3652471e0f9e6e535a109729e3506354
Transpilation MD5: 65849c6fc5270744849237a0d5b5e73b
Author: stefan
Category: javax / os
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-13 16:10:40
Source code size: 617 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 13 / 28
Version history: 3 change(s)
Referenced in: [show]