graphina 0.2.0 → 0.3.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.
- checksums.yaml +4 -4
- data/README.md +4 -4
- data/VERSION +1 -1
- data/graphina.gemspec +3 -3
- data/lib/graphina/graph/formatters.rb +4 -1
- data/lib/graphina/panel/defaults/arm64-darwin.yml +35 -0
- data/lib/graphina/panel/defaults/x86_64-darwin.yml +5 -5
- data/lib/graphina/panel/defaults/x86_64-linux.yml +5 -5
- data/lib/graphina/setup.rb +1 -1
- data/lib/graphina/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f80b47eb1b37298a4d0af81ff87040dfbedfc763d83de640875c4fce56e9d599
|
|
4
|
+
data.tar.gz: 13a399a5f87f2ec2b0b19c36411eaf8799f2b1013a40e4a63f82a9ef33cb6e0d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8eb5ebef9f82cfc6b2321ea4e288bd41703cd4a69fee37e7d1ffc27271e5af65d0698ee4862a17027fc1a5adfa0cd6249704effe656f39ec3f25fa3e997bf5ee
|
|
7
|
+
data.tar.gz: bb3513cdd086d4eb07ebf4f3999e4380522c92f533f0fc17319010127d6f8c847cf309271d6e936112c613a6aabb6e472e62cb01ebe8ee180be8a201e3bc01c4
|
data/README.md
CHANGED
|
@@ -66,12 +66,12 @@ To install one of the included defaults you can try
|
|
|
66
66
|
graphina -S default
|
|
67
67
|
```
|
|
68
68
|
|
|
69
|
-
which attempts to infer a default config for your platform.
|
|
70
|
-
|
|
69
|
+
which attempts to infer a default config for your platform and install it.
|
|
71
70
|
|
|
72
71
|
Currently these platforms are included:
|
|
73
72
|
|
|
74
73
|
- MacOS x86 64 see [x86_64-darwin](lib/graphina/panel/defaults/x86_64-darwin.yml).
|
|
74
|
+
- MacOS ARM 64 see [arm64-darwin](lib/graphina/panel/defaults/arm64-darwin.yml).
|
|
75
75
|
- Linux x86 64 see [x86_64-linux](lib/graphina/panel/defaults/x86_64-linux.yml).
|
|
76
76
|
|
|
77
77
|
These can be installed eplicitly via:
|
|
@@ -109,7 +109,7 @@ graphina -t "CPU Usage (faked)" -f blue -b black
|
|
|
109
109
|
|
|
110
110
|
```bash
|
|
111
111
|
# Monitor CPU usage in real-time
|
|
112
|
-
graphina -t 'CPU Usage' -n 1 -F as_percent -e "top -l 1 -n 0 |
|
|
112
|
+
graphina -t 'CPU Usage' -n 1 -F as_percent -e "top -l 1 -n 0 | awk '/^CPU usage/ {print \$3 + \$5}'"
|
|
113
113
|
```
|
|
114
114
|
|
|
115
115
|
### 4. Using Predefined Panels
|
|
@@ -147,7 +147,7 @@ graph.start
|
|
|
147
147
|
# Using external command for data
|
|
148
148
|
graph = Graphina::Graph.new(
|
|
149
149
|
title: 'Temperature',
|
|
150
|
-
value: ->(i) { `sensors |
|
|
150
|
+
value: ->(i) { `sensors | awk '/^Tctl/ {print \$2}'`.to_f },
|
|
151
151
|
format_value: :as_celsius,
|
|
152
152
|
sleep: 2
|
|
153
153
|
)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.3.0
|
data/graphina.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: graphina 0.
|
|
2
|
+
# stub: graphina 0.3.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "graphina".freeze
|
|
6
|
-
s.version = "0.
|
|
6
|
+
s.version = "0.3.0".freeze
|
|
7
7
|
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
|
9
9
|
s.require_paths = ["lib".freeze]
|
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
|
13
13
|
s.email = "flori@ping.de".freeze
|
|
14
14
|
s.executables = ["graphina".freeze]
|
|
15
15
|
s.extra_rdoc_files = ["README.md".freeze, "lib/graphina.rb".freeze, "lib/graphina/graph.rb".freeze, "lib/graphina/graph/display.rb".freeze, "lib/graphina/graph/display/cell.rb".freeze, "lib/graphina/graph/formatters.rb".freeze, "lib/graphina/graphina_config.rb".freeze, "lib/graphina/panel.rb".freeze, "lib/graphina/panel/chooser.rb".freeze, "lib/graphina/setup.rb".freeze, "lib/graphina/version.rb".freeze]
|
|
16
|
-
s.files = [".utilsrc".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/graphina".freeze, "graphina.gemspec".freeze, "img/graphina.png".freeze, "lib/graphina.rb".freeze, "lib/graphina/graph.rb".freeze, "lib/graphina/graph/display.rb".freeze, "lib/graphina/graph/display/cell.rb".freeze, "lib/graphina/graph/formatters.rb".freeze, "lib/graphina/graphina_config.rb".freeze, "lib/graphina/panel.rb".freeze, "lib/graphina/panel/chooser.rb".freeze, "lib/graphina/panel/defaults/x86_64-darwin.yml".freeze, "lib/graphina/panel/defaults/x86_64-linux.yml".freeze, "lib/graphina/setup.rb".freeze, "lib/graphina/version.rb".freeze]
|
|
16
|
+
s.files = [".utilsrc".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/graphina".freeze, "graphina.gemspec".freeze, "img/graphina.png".freeze, "lib/graphina.rb".freeze, "lib/graphina/graph.rb".freeze, "lib/graphina/graph/display.rb".freeze, "lib/graphina/graph/display/cell.rb".freeze, "lib/graphina/graph/formatters.rb".freeze, "lib/graphina/graphina_config.rb".freeze, "lib/graphina/panel.rb".freeze, "lib/graphina/panel/chooser.rb".freeze, "lib/graphina/panel/defaults/arm64-darwin.yml".freeze, "lib/graphina/panel/defaults/x86_64-darwin.yml".freeze, "lib/graphina/panel/defaults/x86_64-linux.yml".freeze, "lib/graphina/setup.rb".freeze, "lib/graphina/version.rb".freeze]
|
|
17
17
|
s.homepage = "https://github.com/flori/graphina".freeze
|
|
18
18
|
s.licenses = ["MIT".freeze]
|
|
19
19
|
s.rdoc_options = ["--title".freeze, "Graphina - Gem for creating terminal-based data visualizations with real-time\ngraphical displays using Unicode characters and ANSI styling.\n".freeze, "--main".freeze, "README.md".freeze]
|
|
@@ -50,7 +50,10 @@ class Graphina::Graph
|
|
|
50
50
|
#
|
|
51
51
|
# @return [ String ] the formatted frequency representation with unit suffix
|
|
52
52
|
def as_hertz(value)
|
|
53
|
-
|
|
53
|
+
prefix = [
|
|
54
|
+
'', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y',
|
|
55
|
+
].each_with_index.map { |n, i| Tins::Unit::Prefix.new(n.freeze, 1000, 1000 ** i, false) }.freeze
|
|
56
|
+
Tins::Unit.format(value, prefix:, format: '%.3f%U', unit: 'Hz')
|
|
54
57
|
end
|
|
55
58
|
|
|
56
59
|
# The as_celsius method formats a temperature value with a degree symbol
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
cpu_usage_percentage:
|
|
2
|
+
title: "CPU Usage %"
|
|
3
|
+
interval: 1
|
|
4
|
+
command: |
|
|
5
|
+
top -l 1 -n 0 | awk '/^CPU usage:/ { printf "%.1f", $3 + $5 }'
|
|
6
|
+
format_value: as_percent
|
|
7
|
+
color: '#fe8019'
|
|
8
|
+
cpu_temperature:
|
|
9
|
+
title: "CPU Temperature ℃ "
|
|
10
|
+
interval: 1
|
|
11
|
+
command: |
|
|
12
|
+
smctemp -c
|
|
13
|
+
format_value: as_celsius
|
|
14
|
+
color: '#fb4934'
|
|
15
|
+
cpu_clock_average:
|
|
16
|
+
title: "CPU Clock Speed Hz"
|
|
17
|
+
interval: 1
|
|
18
|
+
command: |
|
|
19
|
+
sudo powermetrics --show-usage-summary -s cpu_power -i 100 -n 9 | awk '/CPU [0-9]+ frequency: / { count++; sum += $4 } END { if (count > 0) { print 1000000 * sum / count } else { print 0 } }'
|
|
20
|
+
format_value: as_hertz
|
|
21
|
+
color: '#b8bb26'
|
|
22
|
+
memory_usage:
|
|
23
|
+
title: "Memory Usage"
|
|
24
|
+
interval: 1
|
|
25
|
+
command: |
|
|
26
|
+
free -b | awk '/^Mem:/ { print $4 }'
|
|
27
|
+
format_value: as_bytes
|
|
28
|
+
color: '#689d6a'
|
|
29
|
+
memory_usage_percentage:
|
|
30
|
+
title: "Memory Usage %"
|
|
31
|
+
interval: 1
|
|
32
|
+
command: |
|
|
33
|
+
free -b | awk '/^Mem:/ { printf "%.1f", 100 * $4 / $2 }'
|
|
34
|
+
format_value: as_percent
|
|
35
|
+
color: '#689d6a'
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
cpu_usage_percentage:
|
|
2
|
-
title: "CPU Usage
|
|
2
|
+
title: "CPU Usage %"
|
|
3
3
|
interval: 1
|
|
4
4
|
command: |
|
|
5
5
|
top -l 1 -n 0 | awk '/^CPU usage:/ { printf "%.1f", $3 + $5 }'
|
|
6
6
|
format_value: as_percent
|
|
7
7
|
color: '#fe8019'
|
|
8
8
|
cpu_temperature:
|
|
9
|
-
title: "CPU Temperature
|
|
9
|
+
title: "CPU Temperature ℃ "
|
|
10
10
|
interval: 1
|
|
11
11
|
command: |
|
|
12
12
|
osx-cpu-temp -C | tr -dc '0-9.'
|
|
13
13
|
format_value: as_celsius
|
|
14
14
|
color: '#fb4934'
|
|
15
15
|
cpu_clock_average:
|
|
16
|
-
title: "CPU Clock Speed
|
|
16
|
+
title: "CPU Clock Speed Hz"
|
|
17
17
|
interval: 1
|
|
18
18
|
command: |
|
|
19
|
-
sudo
|
|
19
|
+
sudo powermetrics --show-usage-summary -s cpu_power -i 100 -n 9 | awk '/CPU Average frequency as fraction of nominal: / { count++; gsub(/[^0-9.]/, "", $9); sum += $9 } END { if (count > 0) { print 1000000 * sum / count } else { print 0 } }'
|
|
20
20
|
format_value: as_hertz
|
|
21
21
|
color: '#b8bb26'
|
|
22
22
|
memory_usage:
|
|
@@ -27,7 +27,7 @@ memory_usage:
|
|
|
27
27
|
format_value: as_bytes
|
|
28
28
|
color: '#689d6a'
|
|
29
29
|
memory_usage_percentage:
|
|
30
|
-
title: "Memory Usage
|
|
30
|
+
title: "Memory Usage %"
|
|
31
31
|
interval: 1
|
|
32
32
|
command: |
|
|
33
33
|
free -b | awk '/^Mem:/ { printf "%.1f", 100 * $4 / $2 }'
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
cpu_usage_percentage:
|
|
2
|
-
title: "CPU Usage
|
|
2
|
+
title: "CPU Usage %"
|
|
3
3
|
interval: 1
|
|
4
4
|
command: |
|
|
5
5
|
top -b -n 1 | awk '/^%Cpu\(s\)/ { print $2 + $4 + $6 }'
|
|
6
6
|
format_value: as_percent
|
|
7
7
|
color: '#fe8019'
|
|
8
8
|
cpu_temperature:
|
|
9
|
-
title: "CPU Temperature
|
|
9
|
+
title: "CPU Temperature ℃ "
|
|
10
10
|
interval: 1
|
|
11
11
|
command: |
|
|
12
12
|
sensors | awk '/^Tctl:/ { print $2 }' | tr -dc '0-9.'
|
|
13
13
|
format_value: as_celsius
|
|
14
14
|
color: '#fb4934'
|
|
15
15
|
cpu_clock_average:
|
|
16
|
-
title: "CPU Clock Speed
|
|
16
|
+
title: "CPU Clock Speed Hz"
|
|
17
17
|
interval: 1
|
|
18
18
|
command: |
|
|
19
19
|
awk '/cpu MHz/ {sum += $4; count++} END {if (count > 0) print 1000000 * sum/count}' /proc/cpuinfo
|
|
@@ -27,9 +27,9 @@ memory_usage:
|
|
|
27
27
|
format_value: as_bytes
|
|
28
28
|
color: '#689d6a'
|
|
29
29
|
memory_usage_percentage:
|
|
30
|
-
title: "Memory Usage
|
|
30
|
+
title: "Memory Usage %"
|
|
31
31
|
interval: 1
|
|
32
32
|
command: |
|
|
33
|
-
free -b | awk '/^Mem:/ { printf
|
|
33
|
+
free -b | awk '/^Mem:/ { printf "%.1f", 100 * $3 / $2 }'
|
|
34
34
|
format_value: as_percent
|
|
35
35
|
color: '#689d6a'
|
data/lib/graphina/setup.rb
CHANGED
|
@@ -43,7 +43,7 @@ class Graphina::Setup
|
|
|
43
43
|
# not exist
|
|
44
44
|
def infer_default_panels_path_from_platform
|
|
45
45
|
case RUBY_PLATFORM
|
|
46
|
-
when /\
|
|
46
|
+
when /\A(x86_64|arm64)-darwin/, /\Ax86_64-linux/
|
|
47
47
|
path = default_panels_path($&)
|
|
48
48
|
if path.exist?
|
|
49
49
|
path
|
data/lib/graphina/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: graphina
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Florian Frank
|
|
@@ -152,6 +152,7 @@ files:
|
|
|
152
152
|
- lib/graphina/graphina_config.rb
|
|
153
153
|
- lib/graphina/panel.rb
|
|
154
154
|
- lib/graphina/panel/chooser.rb
|
|
155
|
+
- lib/graphina/panel/defaults/arm64-darwin.yml
|
|
155
156
|
- lib/graphina/panel/defaults/x86_64-darwin.yml
|
|
156
157
|
- lib/graphina/panel/defaults/x86_64-linux.yml
|
|
157
158
|
- lib/graphina/setup.rb
|