-
-
Save FROGGS/e61246c87d9b01998fd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use NativeCall; | |
class cpu_percent_t is repr('CStruct') { | |
has num32 $.user; | |
has num32 $.kernel; | |
has num32 $.idle; | |
has num32 $.iowait; | |
has num32 $.swap; | |
has num32 $.nice; | |
#~ time_t time_taken; | |
} | |
class sg_fs_stats is repr('CStruct') { | |
has Str $.device_name; | |
has Str $.fs_type; | |
has Str $.mnt_point; | |
#~ sg_fs_device_type device_type; | |
#~ unsigned long long size; | |
#~ unsigned long long used; | |
#~ unsigned long long free; | |
#~ unsigned long long avail; | |
#~ unsigned long long total_inodes; | |
#~ unsigned long long used_inodes; | |
#~ unsigned long long free_inodes; | |
#~ unsigned long long avail_inodes; | |
#~ unsigned long long io_size; | |
#~ unsigned long long block_size; | |
#~ unsigned long long total_blocks; | |
#~ unsigned long long free_blocks; | |
#~ unsigned long long used_blocks; | |
#~ unsigned long long avail_blocks; | |
#~ time_t systime; | |
} | |
sub cpu_percent_usage() returns cpu_percent_t is native("libstatgrab") { * }; | |
sub sg_get_fs_stats(CArray[int]) returns sg_fs_stats is native("libstatgrab") { * }; | |
say cpu_percent_usage(); | |
my $carr = CArray[int].new(); | |
say sg_get_fs_stats($carr); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment