Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matsumotory/mruby-cgroup
mruby-cgroups
https://github.com/matsumotory/mruby-cgroup
Last synced: about 2 months ago
JSON representation
mruby-cgroups
- Host: GitHub
- URL: https://github.com/matsumotory/mruby-cgroup
- Owner: matsumotory
- Created: 2013-01-09T15:15:15.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2018-03-27T05:20:45.000Z (almost 7 years ago)
- Last Synced: 2024-10-18T18:26:56.843Z (3 months ago)
- Language: C
- Size: 59.6 KB
- Stars: 18
- Watchers: 4
- Forks: 9
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Cgroup Module for mruby [![Build Status](https://travis-ci.org/matsumotory/mruby-cgroup.svg?branch=master)](https://travis-ci.org/matsumotory/mruby-cgroup)
mruby cgroup module using libcgroup## install by mrbgems
- add conf.gem line to `build_config.rb`
```ruby
MRuby::Build.new do |conf|# ... (snip) ...
conf.gem :git => 'https://github.com/matsumoto-r/mruby-cgroup.git'
end
```## example
```ruby
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| endputs "delete /test group"
rate.delete
core.delete
```# License
under the MIT License:* http://www.opensource.org/licenses/mit-license.php