Skip to content

keizo042/mruby-cgroup

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cgroup Module for mruby Build Status

mruby cgroup module using libcgroup

install by mrbgems

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

    # ... (snip) ...

    conf.gem :git => 'https://github.com/matsumoto-r/mruby-cgroup.git'
end

example

rate = Cgroup::CPU.new "test"
core = Cgroup::CPUSET.new "test"

rate.cfs_quota_us = 30000
core.cpus = core.mems = "0"

rate.create
core.create

# CPU core 0 and rate 30%
puts "attach /test group with cpu core 0 and rate 30%"
rate.attach
core.attach
(1..100000000).each do |i| end

# CPU core 2 and rate 50%
puts "attach /test group with cpu core 2 and rate 50%"
rate.cfs_quota_us = 50000
core.cpus = core.mems = "2"
rate.modify
core.modify
(1..100000000).each do |i| end

# CPU core 0,1,2 and rate 90%
puts "attach /test group with cpu core 0,1,2 and rate 90%"
rate.cfs_quota_us = 90000
core.cpus = core.mems = "0-2"
rate.modify
core.modify
(1..100000000).each do |i| end

puts "delete /test group"
rate.delete
core.delete

License

under the MIT License:

About

mruby-cgroups

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 92.7%
  • Ruby 7.3%