pyre-cli 9.3.0 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -85,6 +85,7 @@ pyre profile save dev # Save active configuration profile
85
85
  pyre profile load dev # Load configuration profile
86
86
  pyre info # Concise hardware, display & Time Machine overview
87
87
  pyre bench "make build" # Benchmark command & estimate kWh energy cost
88
+ pyre benchmark # Run a 1-minute CPU benchmark calculating digits of PI
88
89
  ```
89
90
 
90
91
  ## Options Reference
@@ -150,6 +151,7 @@ These options apply to both static snapshots and `pyre live`, except where noted
150
151
  | Command | Description |
151
152
  |---|---|
152
153
  | `pyre bench <cmd>` | Log CPU, memory, network, power draw, and estimate kWh energy cost during command execution |
154
+ | `pyre benchmark` | Run a 1-minute CPU benchmark calculating digits of PI and score the system |
153
155
  | `pyre xbar` | Generate an xbar / SwiftBar menu bar plugin script for stats display |
154
156
 
155
157
  ### Remote & Multi-host monitoring
@@ -0,0 +1,58 @@
1
+ // src/benchmarkCmd.ts
2
+ import chalk from "chalk";
3
+ async function runBenchmarkCommand() {
4
+ console.log(chalk.bold("\n pyre CPU Benchmark"));
5
+ console.log(chalk.dim(" Calculating digits of Pi to benchmark single-core CPU performance."));
6
+ console.log(chalk.dim(" This will take exactly 1 minute. Please wait...\n"));
7
+ const durationMs = 60 * 1e3;
8
+ const endTime = Date.now() + durationMs;
9
+ let digitsCalculated = 0;
10
+ let q = 1n, r = 0n, t = 1n, k = 1n, n = 3n, l = 3n;
11
+ const spinnerChars = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
12
+ let spinnerIdx = 0;
13
+ const reportInterval = 250;
14
+ let lastReport = Date.now();
15
+ process.stdout.write("\x1B[?25l");
16
+ try {
17
+ while (Date.now() < endTime) {
18
+ for (let i = 0; i < 100; i++) {
19
+ if (4n * q + r - t < n * t) {
20
+ digitsCalculated++;
21
+ const nr = 10n * (r - n * t);
22
+ n = 10n * (3n * q + r) / t - 10n * n;
23
+ q *= 10n;
24
+ r = nr;
25
+ } else {
26
+ const nr = (2n * q + r) * l;
27
+ const nn = (q * (7n * k) + 2n + r * l) / (t * l);
28
+ q *= k;
29
+ t *= l;
30
+ l += 2n;
31
+ k += 1n;
32
+ n = nn;
33
+ r = nr;
34
+ }
35
+ }
36
+ const now = Date.now();
37
+ if (now - lastReport > reportInterval) {
38
+ const elapsed = Math.floor((now - (endTime - durationMs)) / 1e3);
39
+ const remaining = Math.max(0, 60 - elapsed);
40
+ process.stdout.write(`\r ${chalk.cyan(spinnerChars[spinnerIdx])} ${chalk.yellow(digitsCalculated)} digits calculated... ${remaining}s remaining `);
41
+ spinnerIdx = (spinnerIdx + 1) % spinnerChars.length;
42
+ lastReport = now;
43
+ await new Promise((resolve) => setImmediate(resolve));
44
+ }
45
+ }
46
+ } finally {
47
+ process.stdout.write("\x1B[?25h");
48
+ }
49
+ process.stdout.write("\r" + " ".repeat(60) + "\r");
50
+ console.log(chalk.green(` \u2714 Benchmark complete!`));
51
+ console.log(chalk.bold(` Digits calculated: ${chalk.cyan(digitsCalculated)}`));
52
+ const score = Math.floor(digitsCalculated);
53
+ console.log(chalk.bold(` pyre Score: ${chalk.green(score)}
54
+ `));
55
+ }
56
+ export {
57
+ runBenchmarkCommand
58
+ };
package/dist/index.js CHANGED
@@ -5126,6 +5126,7 @@ Commands:
5126
5126
  ssh <host> Stream live stats from a remote Mac over SSH
5127
5127
  fleet <host1> [host2]... Multi-host live dashboard monitoring multiple Macs
5128
5128
  bench <cmd> Log CPU, memory, network, power draw, and estimate kWh cost
5129
+ benchmark Run a 1-minute CPU benchmark calculating digits of PI
5129
5130
  anomalies Compute z-score anomalies and print plain-language digest
5130
5131
  doctor Run system diagnostics
5131
5132
  extensions System Extensions inspector
@@ -5293,6 +5294,11 @@ async function main() {
5293
5294
  await runBenchCommand(benchCmd);
5294
5295
  return;
5295
5296
  }
5297
+ if (cmd === "benchmark") {
5298
+ const { runBenchmarkCommand } = await import("./benchmarkCmd-A3ETK6VY.js");
5299
+ await runBenchmarkCommand();
5300
+ return;
5301
+ }
5296
5302
  if (cmd === "config") {
5297
5303
  const sub = program.args[1];
5298
5304
  if (sub === "show") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pyre-cli",
3
- "version": "9.3.0",
3
+ "version": "9.4.0",
4
4
  "description": "CLI Mac monitoring tool: temps, system stats, live dashboard, packet monitor, battery predictor, export",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -0,0 +1,69 @@
1
+ import chalk from 'chalk';
2
+
3
+ export async function runBenchmarkCommand(): Promise<void> {
4
+ console.log(chalk.bold('\n pyre CPU Benchmark'));
5
+ console.log(chalk.dim(' Calculating digits of Pi to benchmark single-core CPU performance.'));
6
+ console.log(chalk.dim(' This will take exactly 1 minute. Please wait...\n'));
7
+
8
+ const durationMs = 60 * 1000;
9
+ const endTime = Date.now() + durationMs;
10
+ let digitsCalculated = 0;
11
+
12
+ let q = 1n, r = 0n, t = 1n, k = 1n, n = 3n, l = 3n;
13
+
14
+ const spinnerChars = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
15
+ let spinnerIdx = 0;
16
+
17
+ const reportInterval = 250; // ms
18
+ let lastReport = Date.now();
19
+
20
+ process.stdout.write('\x1b[?25l'); // Hide cursor
21
+
22
+ try {
23
+ while (Date.now() < endTime) {
24
+ // Calculate a batch of iterations
25
+ // We do 100 iterations at a time to keep the event loop responsive
26
+ for (let i = 0; i < 100; i++) {
27
+ if (4n * q + r - t < n * t) {
28
+ digitsCalculated++;
29
+ const nr = 10n * (r - n * t);
30
+ n = (10n * (3n * q + r)) / t - 10n * n;
31
+ q *= 10n;
32
+ r = nr;
33
+ } else {
34
+ const nr = (2n * q + r) * l;
35
+ const nn = (q * (7n * k) + 2n + r * l) / (t * l);
36
+ q *= k;
37
+ t *= l;
38
+ l += 2n;
39
+ k += 1n;
40
+ n = nn;
41
+ r = nr;
42
+ }
43
+ }
44
+
45
+ const now = Date.now();
46
+ if (now - lastReport > reportInterval) {
47
+ const elapsed = Math.floor((now - (endTime - durationMs)) / 1000);
48
+ const remaining = Math.max(0, 60 - elapsed);
49
+
50
+ process.stdout.write(`\r ${chalk.cyan(spinnerChars[spinnerIdx])} ${chalk.yellow(digitsCalculated)} digits calculated... ${remaining}s remaining `);
51
+ spinnerIdx = (spinnerIdx + 1) % spinnerChars.length;
52
+ lastReport = now;
53
+
54
+ // Yield to event loop
55
+ await new Promise(resolve => setImmediate(resolve));
56
+ }
57
+ }
58
+ } finally {
59
+ process.stdout.write('\x1b[?25h'); // Show cursor
60
+ }
61
+
62
+ process.stdout.write('\r' + ' '.repeat(60) + '\r'); // Clear line
63
+
64
+ console.log(chalk.green(` ✔ Benchmark complete!`));
65
+ console.log(chalk.bold(` Digits calculated: ${chalk.cyan(digitsCalculated)}`));
66
+
67
+ const score = Math.floor(digitsCalculated);
68
+ console.log(chalk.bold(` pyre Score: ${chalk.green(score)}\n`));
69
+ }
package/src/index.ts CHANGED
@@ -82,6 +82,7 @@ Commands:
82
82
  ssh <host> Stream live stats from a remote Mac over SSH
83
83
  fleet <host1> [host2]... Multi-host live dashboard monitoring multiple Macs
84
84
  bench <cmd> Log CPU, memory, network, power draw, and estimate kWh cost
85
+ benchmark Run a 1-minute CPU benchmark calculating digits of PI
85
86
  anomalies Compute z-score anomalies and print plain-language digest
86
87
  doctor Run system diagnostics
87
88
  extensions System Extensions inspector
@@ -279,6 +280,12 @@ async function main() {
279
280
  return;
280
281
  }
281
282
 
283
+ if (cmd === 'benchmark') {
284
+ const { runBenchmarkCommand } = await import('./benchmarkCmd.js');
285
+ await runBenchmarkCommand();
286
+ return;
287
+ }
288
+
282
289
  if (cmd === 'config') {
283
290
  const sub = program.args[1];
284
291
  if (sub === 'show') {