Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

mruby-resource Build Status

mruby-resouce is the binding of setrlimit(2) and getrlimit(2), getrusage(2) system call

install by mrbgems

  • add conf.gem line to build_config.rb
MRuby::Build.new do |conf|

    # ... (snip) ...

    conf.gem :github => 'harasou/mruby-resource'
end

example

  • setrlimit

    include Resource
    lim = setrlimit(RLIMIT_CPU,5)  #=> nil
  • getrlimit

    include Resource
    lim = getrlimit(RLIMIT_STACK)                                       #=> [8388608, 1.844674407371e+19]
    lim.map{|i| i == RLIM_INFINITY ? "unlimited" : "#{i/(1024**2)}MB" } #=> ["8MB", "unlimited"]
  • getrusage(resource)

    include Resource
    ru = getrusage(RUSAGE_SELF)      #=> {:ru_utime=>0.008506, :ru_stime=>0.008506, :ru_maxrss=>2512, :ru_ixrss=>0, :ru_idrss=>0, :ru_isrss=>0, :ru_minflt=>466, :ru_majflt=>0, :ru_nswap=>0, :ru_inblock=>0, :ru_oublock=>0, :ru_msgsnd=>0, :ru_msgrcv=>0, :ru_nsignals=>0, :ru_nvcsw=>4, :ru_nivcsw=>9}
  • Resource::Rusage#ru_utime

    # TODO: add other rusage method like ru_stime
    Resource::Rusage.new(Resource::RUSAGE_SELF).ru_utime #=> 0.002736

License

under the MIT License:

About

mruby-resource

Resources

License

Releases

No releases published
You can’t perform that action at this time.