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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 01d7b36b52fa20a719ef69531323fb73ee3563a0ae9ec1ca50caac1df0aa3f2b
4
- data.tar.gz: 86f49cb52e5411dd5ca8e24694603945a6c57cf7060833ea530667ed4f8d3535
3
+ metadata.gz: aee9807ee73b58a75f7c4c0d09fcda705f6d8087d51e3c5178ab0472ebd2faae
4
+ data.tar.gz: d9156630e58cc9d4a41b26b7f0666f2abe565de91e8d1636bb8733920a9dfac0
5
5
  SHA512:
6
- metadata.gz: d0ac33e5458a8d21c0d7a397f8708798744da67608c74dd79e250af40b40ada164caa36a2992466e3393a5f0e2e660758923d973c6af16b36dc28de12ca65f92
7
- data.tar.gz: d7cffa14891bf6c766b56870ce3df1bd0ca224694ea33448d9ae259cc4c871ee0178c45f668d24c6308a64818f5c9d71db01bfa99357a43b28a83cf87789862e
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 = get_sector_size(ROOT_DEV)
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
@@ -1,4 +1,4 @@
1
- #!/usr/bin/ruby -w
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 = BlinkTM.diskstats(ROOT)
96
+ io_stat1 = LS::FS.total_io(ROOT)
97
97
  sleep POLLING
98
- io_stat2 = BlinkTM.diskstats(ROOT)
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module BlinkTM
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
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.3.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-04-29 00:00:00.000000000 Z
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.2.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.2.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.15
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
@@ -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
- }
@@ -1,2 +0,0 @@
1
- require 'mkmf'
2
- create_makefile 'blink_tm/diskstats'
@@ -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
- }