Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Created June 13, 2014 21:42
Show Gist options
  • Save FROGGS/ab192c9eac80bcd1b3c0 to your computer and use it in GitHub Desktop.
Save FROGGS/ab192c9eac80bcd1b3c0 to your computer and use it in GitHub Desktop.
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;
}
sub cpu_percent_usage() returns cpu_percent_t is native("libstatgrab") { * };
say cpu_percent_usage();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment