[Gambas-user] (no subject)

Tony Morehen tmorehen at ajm-software.com
Mon Dec 28 17:04:37 CET 2020

I'd suggest a staged approach. First stage would be to put a class 
together and put it in the Software Farm.  People could then try it out, 
test it and suggest additions.  Second stage would be to add it to 
Gambas.  To ease packaging issues, I'd recommend adding the class to a 
related existing component.

Some potential additions: system-related info like memory used, 
available, total (/proc/meminfo).  CPU usage (/proc/stat), cpu/system 
temps (/sys/class/hwmon or sensors), graphics (lspci | grep vga).  See 
PcInfo in Software Farm.

Since most of this data is only needed once, the overhead involved in 
shell calls can be ignored.  The only data that requires frequent calls 
is cpu usage.  /proc/stat data is cumulative since last boot.  To get 
current data, you need to call it about every second.

On 2020-12-28 8:57 a.m., Bruce Steers wrote:
> My apologies i did not add a subject :(
> On Mon, 28 Dec 2020 at 13:31, Bruce Steers <bsteers4 at gmail.com 
> <mailto:bsteers4 at gmail.com>> wrote:
>     I have been looking around but not found much about getting disk
>     drive information.
>     like lsblk
>     i made a component called gb.shell.tools (very WIP at mo)
>     https://gitlab.com/bsteers4/gambas/-/tree/gb.shell.tools/comp/src/gb.shell.tools/.src
>     <https://gitlab.com/bsteers4/gambas/-/tree/gb.shell.tools/comp/src/gb.shell.tools/.src>
>     The premise...
>     Utilise some linux shell commands for things not so available/easy
>     in gambas. (afaik)
>     So far i've added 2 commands that use lsblk to get disk info.
>     The first a basic ListDisks() that returns a String[] of disk
>     paths using *lsblk -lno "PATH"*
>     The other is LiskBlocks() that returns a DeviceInfo[] array with
>     info lsblk finds
>     DeviceInfo.Path
>     DeviceInfo.Name
>     DeviceInfo.Type
>     DeviceInfo.Size
>     DeviceInfo.ByteSize
>     DeviceInfo.UUID
>     DeviceInfo.FSType
>     DeviceInfo.Label
>     DeviceInfo.Mountpoint
>     My questions are...
>     1. Is there a more gambas way to do this rather than using lsblk
>     so it's not even needed?
>     2. Is this a good idea that maybe you could suggest other shell
>     commands you might want added to a component like this?
>     3. Is this a terrible idea and i should be looking into external
>     library functions or a gambas thing
>     that already exists to get disk info?
>     If it is better to use an external lib then if someone can point
>     me in the right direction on using something like liblsblk or some
>     other way to get disk info i'm up for making a better class.
>     Cheers anyone
>     BruceS
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20201228/31103350/attachment-0001.htm>

More information about the User mailing list