blink_tm 0.3.0 → 0.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.
- checksums.yaml +4 -4
- data/lib/blink_tm.rb +3 -2
- data/lib/blink_tm/blink_tm.rb +3 -3
- data/lib/blink_tm/version.rb +1 -1
- metadata +5 -9
- data/ext/diskstats/diskstats.c +0 -41
- data/ext/diskstats/extconf.rb +0 -2
- data/ext/diskstats/sectors.h +0 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aee9807ee73b58a75f7c4c0d09fcda705f6d8087d51e3c5178ab0472ebd2faae
|
|
4
|
+
data.tar.gz: d9156630e58cc9d4a41b26b7f0666f2abe565de91e8d1636bb8733920a9dfac0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 204d49f580218bce9aed96a58a27a1f6fae07996e8d9a911749fec17a621b8c4cfcf2f081e71447e0d61788b22032713239c287d0b1194d6c4e6b048fdcd24a1
|
|
7
|
+
data.tar.gz: 4c269cca6fb02329354483e4495a88da1270c6426a2756315eb8bc88ef0577466165d0f2239181a140bcf04042c04c4ae4b53c0ec53044034bd930954f98f606
|
data/lib/blink_tm.rb
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Frozen_String_Literal: true
|
|
2
2
|
require 'blink_tm/baudrate'
|
|
3
|
-
require 'blink_tm/diskstats'
|
|
4
3
|
require 'linux_stat'
|
|
5
4
|
|
|
5
|
+
$-v = true
|
|
6
|
+
|
|
6
7
|
module BlinkTM
|
|
7
8
|
# Important Constants
|
|
8
9
|
BAUDRATE = BlinkTM::B57600
|
|
@@ -37,7 +38,7 @@ module BlinkTM
|
|
|
37
38
|
ROOT_DEV = ::LinuxStat::Mounts.root
|
|
38
39
|
ROOT = File.split(ROOT_DEV)[-1]
|
|
39
40
|
|
|
40
|
-
SECTORS =
|
|
41
|
+
SECTORS = ::LS::Filesystem.sectors(ROOT_DEV)
|
|
41
42
|
|
|
42
43
|
abort "#{BOLD}#{RED}:: #{Time.now.strftime('%H:%M:%S.%2N')}: Can't get root partition#{RESET}" unless ROOT
|
|
43
44
|
abort "#{BOLD}#{RED}:: #{Time.now.strftime('%H:%M:%S.%2N')}: Can't get sector size#{RESET}" unless SECTORS
|
data/lib/blink_tm/blink_tm.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/ruby
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
2
|
# Frozen_String_Literal: true
|
|
3
3
|
|
|
4
4
|
module BlinkTM
|
|
@@ -93,9 +93,9 @@ module BlinkTM
|
|
|
93
93
|
|
|
94
94
|
Thread.new {
|
|
95
95
|
while true
|
|
96
|
-
io_stat1 =
|
|
96
|
+
io_stat1 = LS::FS.total_io(ROOT)
|
|
97
97
|
sleep POLLING
|
|
98
|
-
io_stat2 =
|
|
98
|
+
io_stat2 = LS::FS.total_io(ROOT)
|
|
99
99
|
|
|
100
100
|
io_r = io_stat2[0].-(io_stat1[0]).*(SECTORS).fdiv(POLLING)
|
|
101
101
|
io_w = io_stat2[1].-(io_stat1[1]).*(SECTORS).fdiv(POLLING)
|
data/lib/blink_tm/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: blink_tm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Sourav Goswami
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-06-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: linux_stat
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: 2.
|
|
19
|
+
version: 2.3.0
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.
|
|
26
|
+
version: 2.3.0
|
|
27
27
|
description: A controller for Arduino OLED System Monitor, Blink Task Manager
|
|
28
28
|
email:
|
|
29
29
|
- souravgoswami@protonmail.com
|
|
@@ -31,15 +31,11 @@ executables:
|
|
|
31
31
|
- blink-tm
|
|
32
32
|
extensions:
|
|
33
33
|
- ext/baudrate/extconf.rb
|
|
34
|
-
- ext/diskstats/extconf.rb
|
|
35
34
|
extra_rdoc_files: []
|
|
36
35
|
files:
|
|
37
36
|
- exe/blink-tm
|
|
38
37
|
- ext/baudrate/baudrate.c
|
|
39
38
|
- ext/baudrate/extconf.rb
|
|
40
|
-
- ext/diskstats/diskstats.c
|
|
41
|
-
- ext/diskstats/extconf.rb
|
|
42
|
-
- ext/diskstats/sectors.h
|
|
43
39
|
- lib/blink_tm.rb
|
|
44
40
|
- lib/blink_tm/blink_tm.rb
|
|
45
41
|
- lib/blink_tm/version.rb
|
|
@@ -62,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
62
58
|
- !ruby/object:Gem::Version
|
|
63
59
|
version: '0'
|
|
64
60
|
requirements: []
|
|
65
|
-
rubygems_version: 3.2.
|
|
61
|
+
rubygems_version: 3.2.18
|
|
66
62
|
signing_key:
|
|
67
63
|
specification_version: 4
|
|
68
64
|
summary: A controller for Arduino OLED System Monitor, Blink Task Manager
|
data/ext/diskstats/diskstats.c
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
#include <stdio.h>
|
|
2
|
-
#include <string.h>
|
|
3
|
-
|
|
4
|
-
#include <sys/ioctl.h>
|
|
5
|
-
#include <fcntl.h>
|
|
6
|
-
#include <linux/fs.h>
|
|
7
|
-
|
|
8
|
-
#include "ruby.h"
|
|
9
|
-
#include "sectors.h"
|
|
10
|
-
|
|
11
|
-
VALUE getDiskstats (volatile VALUE obj, volatile VALUE path) {
|
|
12
|
-
FILE *file = fopen("/proc/diskstats", "r") ;
|
|
13
|
-
if(!file) return rb_ary_new() ;
|
|
14
|
-
|
|
15
|
-
char lines[120] ;
|
|
16
|
-
unsigned long long read, write ;
|
|
17
|
-
char *p = StringValuePtr(path) ;
|
|
18
|
-
|
|
19
|
-
while(fgets(lines, 119, file)) {
|
|
20
|
-
sscanf(lines, "%*s %*s %s %*s %*s %llu %*s %*s %*s %llu", lines, &read, &write) ;
|
|
21
|
-
|
|
22
|
-
if(strcmp(lines, p) == 0) {
|
|
23
|
-
fclose(file) ;
|
|
24
|
-
|
|
25
|
-
return rb_ary_new_from_args(
|
|
26
|
-
2,
|
|
27
|
-
ULL2NUM(read),
|
|
28
|
-
ULL2NUM(write)
|
|
29
|
-
) ;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
fclose(file) ;
|
|
34
|
-
return rb_ary_new() ;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
void Init_diskstats() {
|
|
38
|
-
VALUE blink_tm = rb_define_module("BlinkTM") ;
|
|
39
|
-
rb_define_module_function(blink_tm, "diskstats", getDiskstats, 1) ;
|
|
40
|
-
rb_define_module_function(blink_tm, "get_sector_size", getSectorSize, 1) ;
|
|
41
|
-
}
|
data/ext/diskstats/extconf.rb
DELETED
data/ext/diskstats/sectors.h
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
VALUE getSectorSize (volatile VALUE obj, volatile VALUE path) {
|
|
2
|
-
char *dev = StringValuePtr(path) ;
|
|
3
|
-
|
|
4
|
-
unsigned int fd ;
|
|
5
|
-
unsigned int sSize = 0 ;
|
|
6
|
-
|
|
7
|
-
fd = open(dev, O_RDONLY | O_NONBLOCK) ;
|
|
8
|
-
if(fd < 0) return Qnil ;
|
|
9
|
-
|
|
10
|
-
short status = ioctl(fd, BLKSSZGET, &sSize) ;
|
|
11
|
-
close(fd) ;
|
|
12
|
-
if(status < 0) return Qnil ;
|
|
13
|
-
|
|
14
|
-
return USHORT2NUM(sSize) ;
|
|
15
|
-
}
|